@colyseus/core 0.18.10 → 0.18.12
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/Room.cjs +3 -7
- package/build/Room.cjs.map +2 -2
- package/build/Room.mjs +3 -7
- package/build/Room.mjs.map +2 -2
- package/build/Server.cjs +3 -2
- package/build/Server.cjs.map +2 -2
- package/build/Server.mjs +3 -2
- package/build/Server.mjs.map +2 -2
- package/build/Transport.cjs +1 -1
- package/build/Transport.cjs.map +2 -2
- package/build/Transport.mjs +1 -1
- package/build/Transport.mjs.map +2 -2
- package/package.json +7 -7
- package/src/Room.ts +9 -9
- package/src/Server.ts +7 -4
- package/src/Transport.ts +2 -1
package/build/Room.mjs
CHANGED
|
@@ -445,11 +445,7 @@ var Room = class _Room {
|
|
|
445
445
|
hasReservedSeat(sessionId, reconnectionToken) {
|
|
446
446
|
const reservedSeat = this._reservedSeats[sessionId];
|
|
447
447
|
if (reservedSeat) {
|
|
448
|
-
return
|
|
449
|
-
// not consumed
|
|
450
|
-
reservedSeat[2] === false || // reconnection is allowed and the reconnection token is valid.
|
|
451
|
-
reservedSeat[3] && this._reconnections[reconnectionToken]?.[0] === sessionId
|
|
452
|
-
);
|
|
448
|
+
return reservedSeat[3] ? this._reconnections[reconnectionToken]?.[0] === sessionId : reservedSeat[2] === false;
|
|
453
449
|
} else if (typeof reconnectionToken === "string") {
|
|
454
450
|
return this.clients.get(sessionId)?.reconnectionToken === reconnectionToken;
|
|
455
451
|
}
|
|
@@ -1394,10 +1390,10 @@ var Room = class _Room {
|
|
|
1394
1390
|
debugAndPrintError(`${this.roomName} (roomId: ${this.roomId}), couldn't decode message: ${buffer}`);
|
|
1395
1391
|
return;
|
|
1396
1392
|
}
|
|
1397
|
-
if (this.clock.currentTime - client._lastMessageTime >= 1e3) {
|
|
1393
|
+
if (this.clock.currentTime - (client._lastMessageTime ?? 0) >= 1e3) {
|
|
1398
1394
|
client._numMessagesLastSecond = 0;
|
|
1399
1395
|
client._lastMessageTime = this.clock.currentTime;
|
|
1400
|
-
} else if (
|
|
1396
|
+
} else if ((client._numMessagesLastSecond = (client._numMessagesLastSecond ?? 0) + 1) > this.maxMessagesPerSecond) {
|
|
1401
1397
|
debugMatchMaking("dropping client - sessionId: '%s' (roomId: %s), too many messages per second", client.sessionId, this.roomId);
|
|
1402
1398
|
return this.#_forciblyCloseClient(client, CloseCode.WITH_ERROR);
|
|
1403
1399
|
}
|