@colyseus/sdk 0.17.24 → 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 +7 -3
- package/build/Connection.cjs.map +1 -1
- package/build/Connection.mjs +7 -3
- package/build/Connection.mjs.map +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 +61 -17
- package/dist/colyseus-cocos-creator.js.map +1 -1
- package/dist/colyseus.d.ts +3969 -0
- package/dist/colyseus.js +61 -17
- package/dist/colyseus.js.map +1 -1
- package/dist/debug.js +22 -12
- package/dist/debug.js.map +1 -1
- package/package.json +8 -8
- package/src/Connection.ts +8 -2
- 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
|
|
|
@@ -694,8 +694,12 @@
|
|
|
694
694
|
this.transport.sendUnreliable(data);
|
|
695
695
|
}
|
|
696
696
|
reconnect(queryParams) {
|
|
697
|
-
const
|
|
698
|
-
|
|
697
|
+
const url = new URL(this.url);
|
|
698
|
+
// override query params
|
|
699
|
+
for (const key in queryParams) {
|
|
700
|
+
url.searchParams.set(key, queryParams[key]);
|
|
701
|
+
}
|
|
702
|
+
this.transport.connect(url.toString(), this.options);
|
|
699
703
|
}
|
|
700
704
|
close(code, reason) {
|
|
701
705
|
this.transport.close(code, reason);
|
|
@@ -891,7 +895,10 @@
|
|
|
891
895
|
serializer.state = state;
|
|
892
896
|
serializer.decoder = new schema.Decoder(state);
|
|
893
897
|
}
|
|
894
|
-
this.onLeave(() =>
|
|
898
|
+
this.onLeave(() => {
|
|
899
|
+
this.removeAllListeners();
|
|
900
|
+
this.destroy();
|
|
901
|
+
});
|
|
895
902
|
}
|
|
896
903
|
connect(endpoint, options, headers) {
|
|
897
904
|
var _a;
|
|
@@ -913,7 +920,6 @@
|
|
|
913
920
|
}
|
|
914
921
|
else {
|
|
915
922
|
this.onLeave.invoke(e.code, e.reason);
|
|
916
|
-
this.destroy();
|
|
917
923
|
}
|
|
918
924
|
};
|
|
919
925
|
this.connection.events.onerror = (e) => {
|
|
@@ -1039,6 +1045,8 @@
|
|
|
1039
1045
|
this.onStateChange.clear();
|
|
1040
1046
|
this.onError.clear();
|
|
1041
1047
|
this.onLeave.clear();
|
|
1048
|
+
this.onReconnect.clear();
|
|
1049
|
+
this.onDrop.clear();
|
|
1042
1050
|
this.onMessageHandlers.events = {};
|
|
1043
1051
|
if (this.serializer instanceof SchemaSerializer) {
|
|
1044
1052
|
// Remove callback references
|
|
@@ -1150,6 +1158,7 @@
|
|
|
1150
1158
|
handleReconnection() {
|
|
1151
1159
|
if (Date.now() - this.joinedAtTime < this.reconnection.minUptime) {
|
|
1152
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.");
|
|
1153
1162
|
return;
|
|
1154
1163
|
}
|
|
1155
1164
|
if (!this.reconnection.isReconnecting) {
|
|
@@ -1159,6 +1168,13 @@
|
|
|
1159
1168
|
this.retryReconnection();
|
|
1160
1169
|
}
|
|
1161
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
|
+
}
|
|
1162
1178
|
this.reconnection.retryCount++;
|
|
1163
1179
|
const delay = Math.min(this.reconnection.maxDelay, Math.max(this.reconnection.minDelay, this.reconnection.backoff(this.reconnection.retryCount, this.reconnection.delay)));
|
|
1164
1180
|
console.info(`[Colyseus reconnection]: ${String.fromCodePoint(0x023F3)} will retry in ${(delay / 1000).toFixed(1)} seconds...`); // 🔄
|
|
@@ -1172,13 +1188,7 @@
|
|
|
1172
1188
|
});
|
|
1173
1189
|
}
|
|
1174
1190
|
catch (e) {
|
|
1175
|
-
|
|
1176
|
-
if (this.reconnection.retryCount < this.reconnection.maxRetries) {
|
|
1177
|
-
this.retryReconnection();
|
|
1178
|
-
}
|
|
1179
|
-
else {
|
|
1180
|
-
console.info(`[Colyseus reconnection]: ${String.fromCodePoint(0x274C)} Failed to reconnect. Is your server running? Please check server logs.`); // ❌
|
|
1181
|
-
}
|
|
1191
|
+
this.retryReconnection();
|
|
1182
1192
|
}
|
|
1183
1193
|
}, delay);
|
|
1184
1194
|
}
|