@roeehrl/tinode-sdk 0.25.1-sqlite.13 → 0.25.1-sqlite.14

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@roeehrl/tinode-sdk",
3
3
  "description": "Tinode SDK fork with Storage interface for SQLite persistence in React Native",
4
- "version": "0.25.1-sqlite.13",
4
+ "version": "0.25.1-sqlite.14",
5
5
  "types": "./types/index.d.ts",
6
6
  "scripts": {
7
7
  "format": "js-beautify -r src/*.js",
package/src/connection.js CHANGED
@@ -354,6 +354,9 @@ export default class Connection {
354
354
 
355
355
  this.reconnect = force => {
356
356
  this.#boffStop();
357
+ if (force) {
358
+ this.#boffReset();
359
+ }
357
360
  // Catch the promise to prevent unhandled rejection
358
361
  // Errors are handled via onDisconnect callback instead
359
362
  this.connect(null, force).catch(_ => {
@@ -467,6 +470,9 @@ export default class Connection {
467
470
 
468
471
  this.reconnect = force => {
469
472
  this.#boffStop();
473
+ if (force) {
474
+ this.#boffReset();
475
+ }
470
476
  // Catch the promise to prevent unhandled rejection
471
477
  // Errors are handled via onDisconnect callback instead
472
478
  this.connect(null, force).catch(_ => {
package/src/tinode.js CHANGED
@@ -384,7 +384,7 @@ export class Tinode {
384
384
  if (config.transport != 'lp' && config.transport != 'ws') {
385
385
  config.transport = detectTransport();
386
386
  }
387
- this._connection = new Connection(config, Const.PROTOCOL_VERSION, /* autoreconnect */ true);
387
+ this._connection = new Connection(config, Const.PROTOCOL_VERSION, config.autoreconnect !== false);
388
388
  this._connection.onMessage = (data) => {
389
389
  // Call the main message dispatcher.
390
390
  this.#dispatchMessage(data);
package/types/index.d.ts CHANGED
@@ -31,6 +31,8 @@ declare module '@roeehrl/tinode-sdk' {
31
31
  platform?: 'ios' | 'web' | 'android';
32
32
  /** Enable IndexedDB caching for messages */
33
33
  persist?: boolean;
34
+ /** Enable SDK auto-reconnect on disconnect. Default: true. */
35
+ autoreconnect?: boolean;
34
36
  }
35
37
 
36
38
  // ==========================================================================
package/umd/tinode.dev.js CHANGED
@@ -670,6 +670,9 @@ class Connection {
670
670
  };
671
671
  this.reconnect = force => {
672
672
  this.#boffStop();
673
+ if (force) {
674
+ this.#boffReset();
675
+ }
673
676
  this.connect(null, force).catch(_ => {
674
677
  Connection.#log('LP reconnect promise rejected, error handled via onDisconnect callback');
675
678
  });
@@ -754,6 +757,9 @@ class Connection {
754
757
  };
755
758
  this.reconnect = force => {
756
759
  this.#boffStop();
760
+ if (force) {
761
+ this.#boffReset();
762
+ }
757
763
  this.connect(null, force).catch(_ => {
758
764
  Connection.#log('WS reconnect promise rejected, error handled via onDisconnect callback');
759
765
  });
@@ -5552,7 +5558,7 @@ __webpack_require__.r(__webpack_exports__);
5552
5558
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5553
5559
  /* harmony export */ PACKAGE_VERSION: function() { return /* binding */ PACKAGE_VERSION; }
5554
5560
  /* harmony export */ });
5555
- const PACKAGE_VERSION = "0.25.1-sqlite.13";
5561
+ const PACKAGE_VERSION = "0.25.1-sqlite.14";
5556
5562
 
5557
5563
  /***/ })
5558
5564
 
@@ -5923,7 +5929,7 @@ class Tinode {
5923
5929
  if (config.transport != 'lp' && config.transport != 'ws') {
5924
5930
  config.transport = detectTransport();
5925
5931
  }
5926
- this._connection = new _connection_js__WEBPACK_IMPORTED_MODULE_3__["default"](config, _config_js__WEBPACK_IMPORTED_MODULE_1__.PROTOCOL_VERSION, true);
5932
+ this._connection = new _connection_js__WEBPACK_IMPORTED_MODULE_3__["default"](config, _config_js__WEBPACK_IMPORTED_MODULE_1__.PROTOCOL_VERSION, config.autoreconnect !== false);
5927
5933
  this._connection.onMessage = data => {
5928
5934
  this.#dispatchMessage(data);
5929
5935
  };