@colyseus/core 0.18.14 → 0.18.16
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 +4 -2
- package/build/Room.cjs.map +2 -2
- package/build/Room.mjs +4 -2
- package/build/Room.mjs.map +2 -2
- package/build/Transport.cjs.map +2 -2
- package/build/Transport.d.ts +8 -1
- package/build/Transport.mjs.map +2 -2
- package/package.json +10 -8
- package/src/Room.ts +5 -2
- package/src/Transport.ts +9 -1
package/build/Room.cjs
CHANGED
|
@@ -1422,9 +1422,11 @@ var Room = class _Room {
|
|
|
1422
1422
|
(0, import_Debug.debugAndPrintError)(`${this.roomName} (roomId: ${this.roomId}), couldn't decode message: ${buffer}`);
|
|
1423
1423
|
return;
|
|
1424
1424
|
}
|
|
1425
|
-
|
|
1425
|
+
const now = this.clock.currentTime;
|
|
1426
|
+
client._lastMessageTime = now;
|
|
1427
|
+
if (now >= (client._messageCountResetsAt ?? 0)) {
|
|
1426
1428
|
client._numMessagesLastSecond = 0;
|
|
1427
|
-
client.
|
|
1429
|
+
client._messageCountResetsAt = now + 1e3;
|
|
1428
1430
|
} else if ((client._numMessagesLastSecond = (client._numMessagesLastSecond ?? 0) + 1) > this.maxMessagesPerSecond) {
|
|
1429
1431
|
(0, import_Debug.debugMatchMaking)("dropping client - sessionId: '%s' (roomId: %s), too many messages per second", client.sessionId, this.roomId);
|
|
1430
1432
|
return this.#_forciblyCloseClient(client, import_shared_types.CloseCode.WITH_ERROR);
|