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