@colyseus/core 0.18.2 → 0.18.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/MatchMaker.cjs +2 -2
- package/build/MatchMaker.cjs.map +2 -2
- package/build/MatchMaker.d.ts +10 -4
- package/build/MatchMaker.mjs +2 -2
- package/build/MatchMaker.mjs.map +2 -2
- package/build/Room.cjs +11 -3
- package/build/Room.cjs.map +2 -2
- package/build/Room.d.ts +1 -1
- package/build/Room.mjs +11 -3
- package/build/Room.mjs.map +2 -2
- package/build/RoomMessages.cjs +2 -1
- package/build/RoomMessages.cjs.map +2 -2
- package/build/RoomMessages.d.ts +3 -1
- package/build/RoomMessages.mjs +2 -1
- package/build/RoomMessages.mjs.map +2 -2
- package/build/router/default_routes.cjs +2 -1
- package/build/router/default_routes.cjs.map +2 -2
- package/build/router/default_routes.mjs +2 -1
- package/build/router/default_routes.mjs.map +2 -2
- package/build/router/index.cjs +6 -1
- package/build/router/index.cjs.map +2 -2
- package/build/router/index.d.ts +1 -1
- package/build/router/index.mjs +6 -1
- package/build/router/index.mjs.map +2 -2
- package/build/router/node.cjs +22 -2
- package/build/router/node.cjs.map +2 -2
- package/build/router/node.mjs +22 -2
- package/build/router/node.mjs.map +2 -2
- package/build/utils/Utils.cjs.map +2 -2
- package/build/utils/Utils.d.ts +12 -0
- package/build/utils/Utils.mjs.map +2 -2
- package/build/utils/nanoevents.cjs +4 -1
- package/build/utils/nanoevents.cjs.map +2 -2
- package/build/utils/nanoevents.d.ts +3 -1
- package/build/utils/nanoevents.mjs +4 -1
- package/build/utils/nanoevents.mjs.map +2 -2
- package/package.json +9 -8
- package/src/MatchMaker.ts +33 -12
- package/src/Room.ts +23 -4
- package/src/RoomMessages.ts +2 -1
- package/src/router/default_routes.ts +2 -1
- package/src/router/index.ts +16 -1
- package/src/router/node.ts +26 -2
- package/src/utils/Utils.ts +18 -0
- package/src/utils/nanoevents.ts +4 -1
package/build/Room.mjs
CHANGED
|
@@ -1065,7 +1065,7 @@ var Room = class _Room {
|
|
|
1065
1065
|
* Allow the specified client to reconnect into the room. Must be used inside `onLeave()` method.
|
|
1066
1066
|
* If seconds is provided, the reconnection is going to be cancelled after the provided amount of seconds.
|
|
1067
1067
|
*
|
|
1068
|
-
* @param
|
|
1068
|
+
* @param previousClient - The client that is allowed to reconnect into the room.
|
|
1069
1069
|
* @param seconds - The time in seconds that the client is allowed to reconnect into the room.
|
|
1070
1070
|
*
|
|
1071
1071
|
* @returns Deferred<Client> - The differed is a promise like type.
|
|
@@ -1332,7 +1332,12 @@ var Room = class _Room {
|
|
|
1332
1332
|
#_forciblyCloseClient(client, closeCode, reason) {
|
|
1333
1333
|
client.ref.removeAllListeners("message");
|
|
1334
1334
|
client.ref.removeListener("close", client.ref["onleave"]);
|
|
1335
|
-
|
|
1335
|
+
const ref = client.ref;
|
|
1336
|
+
this._onLeave(client, closeCode).then(() => {
|
|
1337
|
+
if (client.ref === ref) {
|
|
1338
|
+
client.leave(closeCode, reason);
|
|
1339
|
+
}
|
|
1340
|
+
});
|
|
1336
1341
|
}
|
|
1337
1342
|
async _onLeave(client, code) {
|
|
1338
1343
|
const method = code === CloseCode.CONSENTED || client.state === ClientState.RECONNECTING ? this.onLeave : this.onDrop || this.onLeave;
|
|
@@ -1353,11 +1358,14 @@ var Room = class _Room {
|
|
|
1353
1358
|
this.#_onLeaveConcurrent--;
|
|
1354
1359
|
}
|
|
1355
1360
|
}
|
|
1361
|
+
if (client.state === ClientState.RECONNECTED) {
|
|
1362
|
+
return;
|
|
1363
|
+
}
|
|
1356
1364
|
if (this._reconnections[client.reconnectionToken]) {
|
|
1357
1365
|
this._reconnections[client.reconnectionToken][1].catch(async () => {
|
|
1358
1366
|
await this.#_onAfterLeave(client, code, method === this.onDrop);
|
|
1359
1367
|
});
|
|
1360
|
-
} else
|
|
1368
|
+
} else {
|
|
1361
1369
|
await this.#_onAfterLeave(client, code, method === this.onDrop);
|
|
1362
1370
|
}
|
|
1363
1371
|
}
|