@colyseus/sdk 0.17.25 → 0.17.27
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/LICENSE +1 -2
- 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.cjs +1 -1
- package/build/HTTP.mjs +1 -1
- package/build/Room.cjs +17 -11
- package/build/Room.cjs.map +1 -1
- package/build/Room.mjs +17 -11
- 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 +18 -11
- package/dist/colyseus-cocos-creator.js.map +1 -1
- package/dist/colyseus.js +18 -11
- package/dist/colyseus.js.map +1 -1
- package/dist/debug.js +17 -11
- package/dist/debug.js.map +1 -1
- package/package.json +9 -9
- package/src/Room.ts +17 -9
- package/README.md +0 -27
- package/build/HTTP_bkp.d.ts +0 -18
- package/build/Protocol.cjs +0 -34
- package/build/Protocol.cjs.map +0 -1
- package/build/Protocol.d.ts +0 -21
- package/build/Protocol.mjs +0 -34
- package/build/Protocol.mjs.map +0 -1
package/build/core/signal.cjs
CHANGED
package/build/core/signal.mjs
CHANGED
package/build/core/utils.cjs
CHANGED
package/build/core/utils.mjs
CHANGED
package/build/debug.cjs
CHANGED
package/build/debug.mjs
CHANGED
package/build/errors/Errors.cjs
CHANGED
package/build/errors/Errors.mjs
CHANGED
package/build/index.cjs
CHANGED
package/build/index.mjs
CHANGED
package/build/legacy.cjs
CHANGED
package/build/legacy.mjs
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.27 - @colyseus/schema 4.0.8
|
|
7
7
|
// THIS VERSION USES "XMLHttpRequest" INSTEAD OF "fetch" FOR COMPATIBILITY WITH COCOS CREATOR
|
|
8
8
|
(function (global, factory) {
|
|
9
9
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -116,6 +116,7 @@
|
|
|
116
116
|
CONSENTED: 4e3,
|
|
117
117
|
SERVER_SHUTDOWN: 4001,
|
|
118
118
|
WITH_ERROR: 4002,
|
|
119
|
+
FAILED_TO_RECONNECT: 4003,
|
|
119
120
|
MAY_TRY_RECONNECT: 4010
|
|
120
121
|
};
|
|
121
122
|
|
|
@@ -8617,7 +8618,10 @@
|
|
|
8617
8618
|
serializer.state = state;
|
|
8618
8619
|
serializer.decoder = new buildExports.Decoder(state);
|
|
8619
8620
|
}
|
|
8620
|
-
this.onLeave(() =>
|
|
8621
|
+
this.onLeave(() => {
|
|
8622
|
+
this.removeAllListeners();
|
|
8623
|
+
this.destroy();
|
|
8624
|
+
});
|
|
8621
8625
|
}
|
|
8622
8626
|
connect(endpoint, options, headers) {
|
|
8623
8627
|
var _a;
|
|
@@ -8639,7 +8643,6 @@
|
|
|
8639
8643
|
}
|
|
8640
8644
|
else {
|
|
8641
8645
|
this.onLeave.invoke(e.code, e.reason);
|
|
8642
|
-
this.destroy();
|
|
8643
8646
|
}
|
|
8644
8647
|
};
|
|
8645
8648
|
this.connection.events.onerror = (e) => {
|
|
@@ -8656,7 +8659,7 @@
|
|
|
8656
8659
|
this.connection.connect(url.origin, Object.assign(Object.assign({}, options), { skipHandshake }));
|
|
8657
8660
|
}
|
|
8658
8661
|
else {
|
|
8659
|
-
this.connection.connect(`${endpoint}${skipHandshake ? "
|
|
8662
|
+
this.connection.connect(`${endpoint}${skipHandshake ? "&skipHandshake=1" : ""}`, headers);
|
|
8660
8663
|
}
|
|
8661
8664
|
}
|
|
8662
8665
|
leave(consented = true) {
|
|
@@ -8765,6 +8768,8 @@
|
|
|
8765
8768
|
this.onStateChange.clear();
|
|
8766
8769
|
this.onError.clear();
|
|
8767
8770
|
this.onLeave.clear();
|
|
8771
|
+
this.onReconnect.clear();
|
|
8772
|
+
this.onDrop.clear();
|
|
8768
8773
|
this.onMessageHandlers.events = {};
|
|
8769
8774
|
if (this.serializer instanceof SchemaSerializer) {
|
|
8770
8775
|
// Remove callback references
|
|
@@ -8876,6 +8881,7 @@
|
|
|
8876
8881
|
handleReconnection() {
|
|
8877
8882
|
if (Date.now() - this.joinedAtTime < this.reconnection.minUptime) {
|
|
8878
8883
|
console.info(`[Colyseus reconnection]: ${String.fromCodePoint(0x274C)} Room has not been up for long enough for automatic reconnection. (min uptime: ${this.reconnection.minUptime}ms)`); // ❌
|
|
8884
|
+
this.onLeave.invoke(CloseCode.ABNORMAL_CLOSURE, "Room uptime too short for reconnection.");
|
|
8879
8885
|
return;
|
|
8880
8886
|
}
|
|
8881
8887
|
if (!this.reconnection.isReconnecting) {
|
|
@@ -8885,6 +8891,13 @@
|
|
|
8885
8891
|
this.retryReconnection();
|
|
8886
8892
|
}
|
|
8887
8893
|
retryReconnection() {
|
|
8894
|
+
if (this.reconnection.retryCount >= this.reconnection.maxRetries) {
|
|
8895
|
+
// No more retries
|
|
8896
|
+
console.info(`[Colyseus reconnection]: ${String.fromCodePoint(0x274C)} ❌ Reconnection failed after ${this.reconnection.maxRetries} attempts.`); // ❌
|
|
8897
|
+
this.reconnection.isReconnecting = false;
|
|
8898
|
+
this.onLeave.invoke(CloseCode.FAILED_TO_RECONNECT, "No more retries. Reconnection failed.");
|
|
8899
|
+
return;
|
|
8900
|
+
}
|
|
8888
8901
|
this.reconnection.retryCount++;
|
|
8889
8902
|
const delay = Math.min(this.reconnection.maxDelay, Math.max(this.reconnection.minDelay, this.reconnection.backoff(this.reconnection.retryCount, this.reconnection.delay)));
|
|
8890
8903
|
console.info(`[Colyseus reconnection]: ${String.fromCodePoint(0x023F3)} will retry in ${(delay / 1000).toFixed(1)} seconds...`); // 🔄
|
|
@@ -8898,13 +8911,7 @@
|
|
|
8898
8911
|
});
|
|
8899
8912
|
}
|
|
8900
8913
|
catch (e) {
|
|
8901
|
-
|
|
8902
|
-
if (this.reconnection.retryCount < this.reconnection.maxRetries) {
|
|
8903
|
-
this.retryReconnection();
|
|
8904
|
-
}
|
|
8905
|
-
else {
|
|
8906
|
-
console.info(`[Colyseus reconnection]: ${String.fromCodePoint(0x274C)} Failed to reconnect. Is your server running? Please check server logs.`); // ❌
|
|
8907
|
-
}
|
|
8914
|
+
this.retryReconnection();
|
|
8908
8915
|
}
|
|
8909
8916
|
}, delay);
|
|
8910
8917
|
}
|