New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@colyseus/core

Package Overview
Dependencies
Maintainers
1
Versions
143
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@colyseus/core - npm Package Compare versions

Comparing version 0.16.0-preview.37 to 0.16.0

1

build/index.d.ts

@@ -17,3 +17,2 @@ import Clock, { Delayed } from '@colyseus/timer';

export { SchemaSerializer } from './serializer/SchemaSerializer.js';
export { SchemaSerializerDebug } from './serializer/SchemaSerializerDebug.js';
export { Clock, Delayed };

@@ -20,0 +19,0 @@ export { generateId, Deferred, HttpServerMock, spliceOne, getBearerToken } from './utils/Utils.js';

@@ -53,3 +53,2 @@ var __create = Object.create;

SchemaSerializer: () => import_SchemaSerializer.SchemaSerializer,
SchemaSerializerDebug: () => import_SchemaSerializerDebug.SchemaSerializerDebug,
Server: () => import_Server.Server,

@@ -94,3 +93,2 @@ ServerError: () => import_ServerError.ServerError,

var import_SchemaSerializer = require("./serializer/SchemaSerializer.js");
var import_SchemaSerializerDebug = require("./serializer/SchemaSerializerDebug.js");
var import_Utils = require("./utils/Utils.js");

@@ -127,3 +125,2 @@ var import_DevMode = require("./utils/DevMode.js");

SchemaSerializer,
SchemaSerializerDebug,
Server,

@@ -130,0 +127,0 @@ ServerError,

@@ -36,5 +36,4 @@ /**

};
getAvailableRooms(roomName: string): Promise<import("./driver/api.js").IRoomCache[]>;
invokeMethod(method: string, roomName: string, clientOptions?: matchMaker.ClientOptions, authOptions?: AuthContext): Promise<any>;
};
export default _default;

@@ -68,12 +68,2 @@ var __create = Object.create;

},
getAvailableRooms(roomName) {
const conditions = {
locked: false,
private: false
};
if (roomName) {
conditions["name"] = roomName;
}
return matchMaker.query(conditions);
},
async invokeMethod(method, roomName, clientOptions = {}, authOptions) {

@@ -80,0 +70,0 @@ if (this.exposedMethods.indexOf(method) === -1) {

@@ -17,5 +17,2 @@ import { EventEmitter } from 'events';

};
protected subscriptions: {
[id: string]: Callback[];
};
private timeouts;

@@ -22,0 +19,0 @@ constructor();

@@ -45,3 +45,2 @@ var __create = Object.create;

this.keys = {};
this.subscriptions = {};
this.timeouts = {};

@@ -63,6 +62,2 @@ if (import_DevMode.isDevMode && import_fs.default.existsSync(DEVMODE_CACHE_FILE_PATH)) {

subscribe(topic, callback) {
if (!this.subscriptions[topic]) {
this.subscriptions[topic] = [];
}
this.subscriptions[topic].push(callback);
this.channels.on(topic, callback);

@@ -72,18 +67,6 @@ return this;

unsubscribe(topic, callback) {
const topicCallbacks = this.subscriptions[topic];
if (!topicCallbacks) {
return;
}
if (callback) {
const idx = topicCallbacks.indexOf(callback);
if (idx !== -1) {
topicCallbacks.splice(idx, 1);
this.channels.removeListener(topic, callback);
}
if (topicCallbacks.length === 0) {
delete this.subscriptions[topic];
}
this.channels.removeListener(topic, callback);
} else {
topicCallbacks.forEach((cb) => this.channels.removeListener(topic, cb));
delete this.subscriptions[topic];
this.channels.removeAllListeners(topic);
}

@@ -97,3 +80,3 @@ return this;

async exists(key) {
return this.channels.listenerCount(key) > 0;
return this.keys[key] !== void 0 || this.data[key] !== void 0 || this.hash[key] !== void 0;
}

@@ -100,0 +83,0 @@ set(key, value) {

23

build/Room.js

@@ -104,4 +104,4 @@ var __create = Object.create;

callback: (client, messageType, _) => {
const errorMessage = `onMessage for "${messageType}" not registered.`;
(0, import_Debug.debugAndPrintError)(errorMessage);
const errorMessage = `room onMessage for "${messageType}" not registered.`;
(0, import_Debug.debugAndPrintError)(`${errorMessage} (roomId: ${this.roomId})`);
if (import_DevMode.isDevMode) {

@@ -121,3 +121,3 @@ client.error(import_Protocol.ErrorCode.INVALID_PAYLOAD, errorMessage);

this._events.once("dispose", () => {
this._dispose().catch((e) => (0, import_Debug.debugAndPrintError)(`onDispose error: ${e && e.stack || e.message || e || "promise rejected"}`)).finally(() => this._events.emit("disconnect"));
this._dispose().catch((e) => (0, import_Debug.debugAndPrintError)(`onDispose error: ${e && e.stack || e.message || e || "promise rejected"} (roomId: ${this.roomId})`)).finally(() => this._events.emit("disconnect"));
});

@@ -515,3 +515,3 @@ if (this.onUncaughtException !== void 0) {

this.reservedSeats[sessionId][2] = true;
(0, import_Debug.debugMatchMaking)("consuming seat reservation, sessionId: '%s'", client.sessionId);
(0, import_Debug.debugMatchMaking)("consuming seat reservation, sessionId: '%s' (roomId: %s)", client.sessionId, this.roomId);
client._afterNextPatchQueue = this._afterNextPatchQueue;

@@ -624,4 +624,5 @@ client.ref["onleave"] = (_) => client.state = import_Transport.ClientState.LEAVING;

newClient.userData = previousClient.userData;
previousClient.state = import_Transport.ClientState.RECONNECTED;
previousClient.ref = newClient.ref;
previousClient.state = import_Transport.ClientState.RECONNECTED;
previousClient.reconnectionToken = newClient.reconnectionToken;
clearTimeout(this.reservedSeatTimeouts[sessionId]);

@@ -646,3 +647,3 @@ cleanup();

broadcastMessageType(type, message, options = {}) {
(0, import_Debug.debugMessage)("broadcast: %O", message);
(0, import_Debug.debugMessage)("broadcast: %O (roomId: %s)", message, this.roomId);
const encodedMessage = message instanceof Uint8Array ? import_Protocol.getMessageBytes.raw(import_Protocol.Protocol.ROOM_DATA_BYTES, type, void 0, message) : import_Protocol.getMessageBytes.raw(import_Protocol.Protocol.ROOM_DATA, type, message);

@@ -732,3 +733,3 @@ const except = typeof options.except !== "undefined" ? Array.isArray(options.except) ? options.except : [options.except] : void 0;

if (!buffer) {
(0, import_Debug.debugAndPrintError)(`${this.roomName} (${this.roomId}), couldn't decode message: ${buffer}`);
(0, import_Debug.debugAndPrintError)(`${this.roomName} (roomId: ${this.roomId}), couldn't decode message: ${buffer}`);
return;

@@ -742,3 +743,3 @@ }

message = buffer.byteLength > it.offset ? (0, import_msgpackr.unpack)(buffer.subarray(it.offset, buffer.byteLength)) : void 0;
(0, import_Debug.debugMessage)("received: '%s' -> %j", messageType, message);
(0, import_Debug.debugMessage)("received: '%s' -> %j (roomId: %s)", messageType, message, this.roomId);
if (messageTypeHandler?.validate !== void 0) {

@@ -761,3 +762,3 @@ message = messageTypeHandler.validate(message);

let message = buffer.subarray(it.offset, buffer.byteLength);
(0, import_Debug.debugMessage)("received: '%s' -> %j", messageType, message);
(0, import_Debug.debugMessage)("received: '%s' -> %j (roomId: %s)", messageType, message, this.roomId);
if (messageTypeHandler?.validate !== void 0) {

@@ -791,3 +792,3 @@ message = messageTypeHandler.validate(message);

async _onLeave(client, code) {
(0, import_Debug.debugMatchMaking)("onLeave, sessionId: '%s'", client.sessionId);
(0, import_Debug.debugMatchMaking)("onLeave, sessionId: '%s' (close code: %d, roomId: %s)", client.sessionId, code, this.roomId);
client.state = import_Transport.ClientState.LEAVING;

@@ -802,3 +803,3 @@ if (!this.clients.delete(client)) {

} catch (e) {
(0, import_Debug.debugAndPrintError)(`onLeave error: ${e && e.message || e || "promise rejected"}`);
(0, import_Debug.debugAndPrintError)(`onLeave error: ${e && e.message || e || "promise rejected"} (roomId: ${this.roomId})`);
} finally {

@@ -805,0 +806,0 @@ this.#_onLeaveConcurrent--;

@@ -10,3 +10,3 @@ import { MapSchema, Schema } from '@colyseus/schema';

declare class State extends Schema {
players: MapSchema<Player, string>;
players: MapSchema<Player>;
}

@@ -13,0 +13,0 @@ /**

@@ -7,11 +7,2 @@ /**

*/
import fs from 'fs';
import { SchemaSerializer } from './SchemaSerializer.js';
import { Client } from "../Transport.js";
export declare class SchemaSerializerDebug<T> extends SchemaSerializer<T> {
protected debugStream: fs.WriteStream;
constructor(fileName?: string);
getFullState(client?: Client): Buffer;
applyPatches(clients: Client[]): boolean;
handshake(): Buffer;
}
export {};

@@ -253,7 +253,3 @@ var __create = Object.create;

} else if (req.method === "GET") {
const matchedParams = req.url.match(matchMaker.controller.allowedRoomNameChars);
const roomName = matchedParams.length > 1 ? matchedParams[matchedParams.length - 1] : "";
headers["Content-Type"] = "application/json";
res.writeHead(200, headers);
res.write(JSON.stringify(await matchMaker.controller.getAvailableRooms(roomName)));
res.writeHead(404, headers);
res.end();

@@ -260,0 +256,0 @@ }

{
"name": "@colyseus/core",
"version": "0.16.0-preview.37",
"version": "0.16.0",
"description": "Multiplayer Framework for Node.js.",

@@ -5,0 +5,0 @@ "input": "./src/index.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc