@colyseus/core 0.18.13 → 0.18.15
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 +1 -0
- package/build/MatchMaker.cjs.map +2 -2
- package/build/MatchMaker.mjs +1 -0
- package/build/MatchMaker.mjs.map +2 -2
- 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 +4 -4
- package/src/MatchMaker.ts +4 -0
- package/src/Room.ts +5 -2
- package/src/Transport.ts +9 -1
package/build/Room.mjs
CHANGED
|
@@ -1393,9 +1393,11 @@ var Room = class _Room {
|
|
|
1393
1393
|
debugAndPrintError(`${this.roomName} (roomId: ${this.roomId}), couldn't decode message: ${buffer}`);
|
|
1394
1394
|
return;
|
|
1395
1395
|
}
|
|
1396
|
-
|
|
1396
|
+
const now = this.clock.currentTime;
|
|
1397
|
+
client._lastMessageTime = now;
|
|
1398
|
+
if (now >= (client._messageCountResetsAt ?? 0)) {
|
|
1397
1399
|
client._numMessagesLastSecond = 0;
|
|
1398
|
-
client.
|
|
1400
|
+
client._messageCountResetsAt = now + 1e3;
|
|
1399
1401
|
} else if ((client._numMessagesLastSecond = (client._numMessagesLastSecond ?? 0) + 1) > this.maxMessagesPerSecond) {
|
|
1400
1402
|
debugMatchMaking("dropping client - sessionId: '%s' (roomId: %s), too many messages per second", client.sessionId, this.roomId);
|
|
1401
1403
|
return this.#_forciblyCloseClient(client, CloseCode.WITH_ERROR);
|