@colyseus/sdk 0.17.25 → 0.17.26
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/3rd_party/discord.cjs +1 -1
- package/build/3rd_party/discord.mjs +1 -1
- package/build/Auth.cjs +1 -1
- package/build/Auth.mjs +1 -1
- package/build/Client.cjs +1 -1
- package/build/Client.mjs +1 -1
- package/build/Connection.cjs +1 -1
- package/build/Connection.mjs +1 -1
- package/build/HTTP.bkp.d.ts +103 -0
- package/build/HTTP.cjs +1 -1
- package/build/HTTP.mjs +1 -1
- package/build/Room.cjs +16 -10
- package/build/Room.cjs.map +1 -1
- package/build/Room.mjs +16 -10
- package/build/Room.mjs.map +1 -1
- package/build/Storage.cjs +1 -1
- package/build/Storage.mjs +1 -1
- package/build/core/nanoevents.cjs +1 -1
- package/build/core/nanoevents.mjs +1 -1
- package/build/core/signal.cjs +1 -1
- package/build/core/signal.mjs +1 -1
- package/build/core/utils.cjs +1 -1
- package/build/core/utils.mjs +1 -1
- package/build/debug.cjs +1 -1
- package/build/debug.mjs +1 -1
- package/build/errors/Errors.cjs +1 -1
- package/build/errors/Errors.mjs +1 -1
- package/build/index.cjs +1 -1
- package/build/index.mjs +1 -1
- package/build/legacy.cjs +1 -1
- package/build/legacy.mjs +1 -1
- package/build/serializer/NoneSerializer.cjs +1 -1
- package/build/serializer/NoneSerializer.mjs +1 -1
- package/build/serializer/SchemaSerializer.cjs +1 -1
- package/build/serializer/SchemaSerializer.mjs +1 -1
- package/build/serializer/Serializer.cjs +1 -1
- package/build/serializer/Serializer.mjs +1 -1
- package/build/transport/H3Transport.cjs +1 -1
- package/build/transport/H3Transport.mjs +1 -1
- package/build/transport/WebSocketTransport.cjs +1 -1
- package/build/transport/WebSocketTransport.mjs +1 -1
- package/dist/colyseus-cocos-creator.js +17 -10
- package/dist/colyseus-cocos-creator.js.map +1 -1
- package/dist/colyseus.d.ts +3969 -0
- package/dist/colyseus.js +17 -10
- package/dist/colyseus.js.map +1 -1
- package/dist/debug.js +16 -10
- package/dist/debug.js.map +1 -1
- package/package.json +8 -8
- package/src/Room.ts +16 -8
package/dist/debug.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// This software is released under the MIT License.
|
|
4
4
|
// https://opensource.org/license/MIT
|
|
5
5
|
//
|
|
6
|
-
// colyseus.js@0.17.
|
|
6
|
+
// colyseus.js@0.17.26
|
|
7
7
|
(function (sharedTypes, schema, msgpackr, NodeWebSocket) {
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
@@ -895,7 +895,10 @@
|
|
|
895
895
|
serializer.state = state;
|
|
896
896
|
serializer.decoder = new schema.Decoder(state);
|
|
897
897
|
}
|
|
898
|
-
this.onLeave(() =>
|
|
898
|
+
this.onLeave(() => {
|
|
899
|
+
this.removeAllListeners();
|
|
900
|
+
this.destroy();
|
|
901
|
+
});
|
|
899
902
|
}
|
|
900
903
|
connect(endpoint, options, headers) {
|
|
901
904
|
var _a;
|
|
@@ -917,7 +920,6 @@
|
|
|
917
920
|
}
|
|
918
921
|
else {
|
|
919
922
|
this.onLeave.invoke(e.code, e.reason);
|
|
920
|
-
this.destroy();
|
|
921
923
|
}
|
|
922
924
|
};
|
|
923
925
|
this.connection.events.onerror = (e) => {
|
|
@@ -1043,6 +1045,8 @@
|
|
|
1043
1045
|
this.onStateChange.clear();
|
|
1044
1046
|
this.onError.clear();
|
|
1045
1047
|
this.onLeave.clear();
|
|
1048
|
+
this.onReconnect.clear();
|
|
1049
|
+
this.onDrop.clear();
|
|
1046
1050
|
this.onMessageHandlers.events = {};
|
|
1047
1051
|
if (this.serializer instanceof SchemaSerializer) {
|
|
1048
1052
|
// Remove callback references
|
|
@@ -1154,6 +1158,7 @@
|
|
|
1154
1158
|
handleReconnection() {
|
|
1155
1159
|
if (Date.now() - this.joinedAtTime < this.reconnection.minUptime) {
|
|
1156
1160
|
console.info(`[Colyseus reconnection]: ${String.fromCodePoint(0x274C)} Room has not been up for long enough for automatic reconnection. (min uptime: ${this.reconnection.minUptime}ms)`); // ❌
|
|
1161
|
+
this.onLeave.invoke(sharedTypes.CloseCode.ABNORMAL_CLOSURE, "Room uptime too short for reconnection.");
|
|
1157
1162
|
return;
|
|
1158
1163
|
}
|
|
1159
1164
|
if (!this.reconnection.isReconnecting) {
|
|
@@ -1163,6 +1168,13 @@
|
|
|
1163
1168
|
this.retryReconnection();
|
|
1164
1169
|
}
|
|
1165
1170
|
retryReconnection() {
|
|
1171
|
+
if (this.reconnection.retryCount >= this.reconnection.maxRetries) {
|
|
1172
|
+
// No more retries
|
|
1173
|
+
console.info(`[Colyseus reconnection]: ${String.fromCodePoint(0x274C)} ❌ Reconnection failed after ${this.reconnection.maxRetries} attempts.`); // ❌
|
|
1174
|
+
this.reconnection.isReconnecting = false;
|
|
1175
|
+
this.onLeave.invoke(sharedTypes.CloseCode.FAILED_TO_RECONNECT, "No more retries. Reconnection failed.");
|
|
1176
|
+
return;
|
|
1177
|
+
}
|
|
1166
1178
|
this.reconnection.retryCount++;
|
|
1167
1179
|
const delay = Math.min(this.reconnection.maxDelay, Math.max(this.reconnection.minDelay, this.reconnection.backoff(this.reconnection.retryCount, this.reconnection.delay)));
|
|
1168
1180
|
console.info(`[Colyseus reconnection]: ${String.fromCodePoint(0x023F3)} will retry in ${(delay / 1000).toFixed(1)} seconds...`); // 🔄
|
|
@@ -1176,13 +1188,7 @@
|
|
|
1176
1188
|
});
|
|
1177
1189
|
}
|
|
1178
1190
|
catch (e) {
|
|
1179
|
-
|
|
1180
|
-
if (this.reconnection.retryCount < this.reconnection.maxRetries) {
|
|
1181
|
-
this.retryReconnection();
|
|
1182
|
-
}
|
|
1183
|
-
else {
|
|
1184
|
-
console.info(`[Colyseus reconnection]: ${String.fromCodePoint(0x274C)} Failed to reconnect. Is your server running? Please check server logs.`); // ❌
|
|
1185
|
-
}
|
|
1191
|
+
this.retryReconnection();
|
|
1186
1192
|
}
|
|
1187
1193
|
}, delay);
|
|
1188
1194
|
}
|