@colyseus/sdk 0.17.33 → 0.17.35

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.
Files changed (52) hide show
  1. package/build/3rd_party/discord.cjs +1 -1
  2. package/build/3rd_party/discord.mjs +1 -1
  3. package/build/Auth.cjs +1 -1
  4. package/build/Auth.mjs +1 -1
  5. package/build/Client.cjs +1 -1
  6. package/build/Client.mjs +1 -1
  7. package/build/Connection.cjs +1 -1
  8. package/build/Connection.mjs +1 -1
  9. package/build/HTTP.cjs +1 -1
  10. package/build/HTTP.mjs +1 -1
  11. package/build/Room.cjs +8 -3
  12. package/build/Room.cjs.map +1 -1
  13. package/build/Room.d.ts +6 -0
  14. package/build/Room.mjs +8 -3
  15. package/build/Room.mjs.map +1 -1
  16. package/build/Storage.cjs +1 -1
  17. package/build/Storage.mjs +1 -1
  18. package/build/core/nanoevents.cjs +1 -1
  19. package/build/core/nanoevents.mjs +1 -1
  20. package/build/core/signal.cjs +1 -1
  21. package/build/core/signal.mjs +1 -1
  22. package/build/core/utils.cjs +1 -1
  23. package/build/core/utils.mjs +1 -1
  24. package/build/debug.cjs +8 -8
  25. package/build/debug.cjs.map +1 -1
  26. package/build/debug.mjs +8 -8
  27. package/build/debug.mjs.map +1 -1
  28. package/build/errors/Errors.cjs +1 -1
  29. package/build/errors/Errors.mjs +1 -1
  30. package/build/index.cjs +1 -1
  31. package/build/index.mjs +1 -1
  32. package/build/legacy.cjs +1 -1
  33. package/build/legacy.mjs +1 -1
  34. package/build/serializer/NoneSerializer.cjs +1 -1
  35. package/build/serializer/NoneSerializer.mjs +1 -1
  36. package/build/serializer/SchemaSerializer.cjs +1 -1
  37. package/build/serializer/SchemaSerializer.mjs +1 -1
  38. package/build/serializer/Serializer.cjs +1 -1
  39. package/build/serializer/Serializer.mjs +1 -1
  40. package/build/transport/H3Transport.cjs +1 -1
  41. package/build/transport/H3Transport.mjs +1 -1
  42. package/build/transport/WebSocketTransport.cjs +1 -1
  43. package/build/transport/WebSocketTransport.mjs +1 -1
  44. package/dist/colyseus-cocos-creator.js +23 -6
  45. package/dist/colyseus-cocos-creator.js.map +1 -1
  46. package/dist/colyseus.js +23 -6
  47. package/dist/colyseus.js.map +1 -1
  48. package/dist/debug.js +8 -8
  49. package/dist/debug.js.map +1 -1
  50. package/package.json +2 -2
  51. package/src/Room.ts +15 -2
  52. package/src/debug.ts +7 -7
@@ -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.33
6
+ // colyseus.js@0.17.35
7
7
  'use strict';
8
8
 
9
9
  class ServerError extends Error {
@@ -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.33
6
+ // colyseus.js@0.17.35
7
7
  class ServerError extends Error {
8
8
  code;
9
9
  headers;
package/build/index.cjs 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.33
6
+ // colyseus.js@0.17.35
7
7
  'use strict';
8
8
 
9
9
  require('./legacy.cjs');
package/build/index.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.33
6
+ // colyseus.js@0.17.35
7
7
  import './legacy.mjs';
8
8
  export { Client, ColyseusSDK } from './Client.mjs';
9
9
  export { Room } from './Room.mjs';
package/build/legacy.cjs 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.33
6
+ // colyseus.js@0.17.35
7
7
  'use strict';
8
8
 
9
9
  //
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.33
6
+ // colyseus.js@0.17.35
7
7
  //
8
8
  // Polyfills for legacy environments
9
9
  //
@@ -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.33
6
+ // colyseus.js@0.17.35
7
7
  'use strict';
8
8
 
9
9
  class NoneSerializer {
@@ -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.33
6
+ // colyseus.js@0.17.35
7
7
  class NoneSerializer {
8
8
  setState(rawState) { }
9
9
  getState() { return null; }
@@ -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.33
6
+ // colyseus.js@0.17.35
7
7
  'use strict';
8
8
 
9
9
  var schema = require('@colyseus/schema');
@@ -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.33
6
+ // colyseus.js@0.17.35
7
7
  import { getDecoderStateCallbacks, Reflection, Decoder } from '@colyseus/schema';
8
8
 
9
9
  //
@@ -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.33
6
+ // colyseus.js@0.17.35
7
7
  'use strict';
8
8
 
9
9
  const serializers = {};
@@ -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.33
6
+ // colyseus.js@0.17.35
7
7
  const serializers = {};
8
8
  function registerSerializer(id, serializer) {
9
9
  serializers[id] = serializer;
@@ -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.33
6
+ // colyseus.js@0.17.35
7
7
  'use strict';
8
8
 
9
9
  var tslib = require('tslib');
@@ -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.33
6
+ // colyseus.js@0.17.35
7
7
  import { encode, decode } from '@colyseus/schema';
8
8
 
9
9
  class H3TransportTransport {
@@ -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.33
6
+ // colyseus.js@0.17.35
7
7
  'use strict';
8
8
 
9
9
  var NodeWebSocket = require('ws');
@@ -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.33
6
+ // colyseus.js@0.17.35
7
7
  import NodeWebSocket from 'ws';
8
8
  import { CloseCode } from '@colyseus/shared-types';
9
9
 
@@ -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.33 - @colyseus/schema 4.0.11
6
+ // colyseus.js@0.17.35 - @colyseus/schema 4.0.13
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) :
@@ -4219,7 +4219,11 @@
4219
4219
  const ref = changeTree.ref;
4220
4220
  // Assign unique `refId` to ref if it doesn't have one yet.
4221
4221
  if (ref[$refId] === undefined) {
4222
- ref[$refId] = this.getNextUniqueId();
4222
+ Object.defineProperty(ref, $refId, {
4223
+ value: this.getNextUniqueId(),
4224
+ enumerable: false,
4225
+ writable: true
4226
+ });
4223
4227
  }
4224
4228
  const refId = ref[$refId];
4225
4229
  const isNewChangeTree = (this.changeTrees[refId] === undefined);
@@ -4661,7 +4665,11 @@
4661
4665
  // for decoding
4662
4666
  addRef(refId, ref, incrementCount = true) {
4663
4667
  this.refs.set(refId, ref);
4664
- ref[$refId] = refId;
4668
+ Object.defineProperty(ref, $refId, {
4669
+ value: refId,
4670
+ enumerable: false,
4671
+ writable: true
4672
+ });
4665
4673
  if (incrementCount) {
4666
4674
  this.refCount[refId] = (this.refCount[refId] || 0) + 1;
4667
4675
  }
@@ -5353,11 +5361,15 @@
5353
5361
  const collection = instance[propertyName];
5354
5362
  // Collection not available yet. Listen for its availability before attaching the handler.
5355
5363
  if (!collection || collection[$refId] === undefined) {
5356
- removeHandler = this.addCallback(instance[$refId], propertyName, (value, _) => {
5364
+ let removePropertyCallback;
5365
+ removePropertyCallback = this.addCallback(instance[$refId], propertyName, (value, _) => {
5357
5366
  if (value !== null && value !== undefined) {
5367
+ // Remove the property listener now that collection is available
5368
+ removePropertyCallback();
5358
5369
  removeHandler = this.addCallback(value[$refId], operation, handler);
5359
5370
  }
5360
5371
  });
5372
+ removeHandler = removePropertyCallback;
5361
5373
  return removeOnAdd;
5362
5374
  }
5363
5375
  else {
@@ -8592,6 +8604,7 @@
8592
8604
  this.onJoin = createSignal();
8593
8605
  // reconnection logic
8594
8606
  this.reconnection = {
8607
+ enabled: true,
8595
8608
  retryCount: 0,
8596
8609
  maxRetries: 15,
8597
8610
  delay: 100,
@@ -8639,7 +8652,7 @@
8639
8652
  e.code === CloseCode.GOING_AWAY ||
8640
8653
  e.code === CloseCode.MAY_TRY_RECONNECT) {
8641
8654
  this.onDrop.invoke(e.code, e.reason);
8642
- this.handleReconnection();
8655
+ this.handleReconnection(e.code, e.reason);
8643
8656
  }
8644
8657
  else {
8645
8658
  this.onLeave.invoke(e.code, e.reason);
@@ -8878,7 +8891,11 @@
8878
8891
  default: throw new Error("invalid message type.");
8879
8892
  }
8880
8893
  }
8881
- handleReconnection() {
8894
+ handleReconnection(code, reason) {
8895
+ if (!this.reconnection.enabled) {
8896
+ this.onLeave.invoke(code, reason);
8897
+ return;
8898
+ }
8882
8899
  if (Date.now() - this.joinedAtTime < this.reconnection.minUptime) {
8883
8900
  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
8901
  this.onLeave.invoke(CloseCode.ABNORMAL_CLOSURE, "Room uptime too short for reconnection.");