centrifuge 5.3.4 → 5.3.5

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/README.md CHANGED
@@ -605,7 +605,7 @@ getSubscription returns `Subscription` if it's registered in the internal regist
605
605
 
606
606
  `removeSubscription(sub: Subscription | null)`
607
607
 
608
- removeSubscription allows removing Subcription from the internal registry. Subscrption must be in unsubscribed state.
608
+ removeSubscription allows removing Subcription from the internal registry.
609
609
 
610
610
  ### subscriptions
611
611
 
@@ -57,8 +57,7 @@ export declare class Centrifuge extends Centrifuge_base {
57
57
  /** getSubscription returns Subscription if it's registered in the internal
58
58
  * registry or null. */
59
59
  getSubscription(channel: string): Subscription | null;
60
- /** removeSubscription allows removing Subcription from the internal registry. Subscrption
61
- * must be in unsubscribed state. */
60
+ /** removeSubscription allows removing Subcription from the internal registry. */
62
61
  removeSubscription(sub: Subscription | null): void;
63
62
  /** Get a map with all current client-side subscriptions. */
64
63
  subscriptions(): Record<string, Subscription>;
package/build/index.js CHANGED
@@ -1136,8 +1136,8 @@ class Subscription extends EventEmitter$1 {
1136
1136
  return;
1137
1137
  }
1138
1138
  if (options.since) {
1139
- this._offset = options.since.offset;
1140
- this._epoch = options.since.epoch;
1139
+ this._offset = options.since.offset || 0;
1140
+ this._epoch = options.since.epoch || '';
1141
1141
  this._recover = true;
1142
1142
  }
1143
1143
  if (options.data) {
@@ -1215,7 +1215,7 @@ class Subscription extends EventEmitter$1 {
1215
1215
  message: 'provide a function to get channel subscription token'
1216
1216
  }
1217
1217
  });
1218
- throw new UnauthorizedError('');
1218
+ return Promise.reject(new UnauthorizedError(''));
1219
1219
  }
1220
1220
  return getToken(ctx);
1221
1221
  }
@@ -2139,8 +2139,7 @@ class Centrifuge extends EventEmitter$1 {
2139
2139
  getSubscription(channel) {
2140
2140
  return this._getSub(channel);
2141
2141
  }
2142
- /** removeSubscription allows removing Subcription from the internal registry. Subscrption
2143
- * must be in unsubscribed state. */
2142
+ /** removeSubscription allows removing Subcription from the internal registry. */
2144
2143
  removeSubscription(sub) {
2145
2144
  if (!sub) {
2146
2145
  return;
@@ -3186,7 +3185,7 @@ class Centrifuge extends EventEmitter$1 {
3186
3185
  message: 'token expired but no getToken function set in the configuration'
3187
3186
  }
3188
3187
  });
3189
- throw new UnauthorizedError('');
3188
+ return Promise.reject(new UnauthorizedError(''));
3190
3189
  }
3191
3190
  return this._config.getToken({});
3192
3191
  }
package/build/index.mjs CHANGED
@@ -1134,8 +1134,8 @@ class Subscription extends EventEmitter$1 {
1134
1134
  return;
1135
1135
  }
1136
1136
  if (options.since) {
1137
- this._offset = options.since.offset;
1138
- this._epoch = options.since.epoch;
1137
+ this._offset = options.since.offset || 0;
1138
+ this._epoch = options.since.epoch || '';
1139
1139
  this._recover = true;
1140
1140
  }
1141
1141
  if (options.data) {
@@ -1213,7 +1213,7 @@ class Subscription extends EventEmitter$1 {
1213
1213
  message: 'provide a function to get channel subscription token'
1214
1214
  }
1215
1215
  });
1216
- throw new UnauthorizedError('');
1216
+ return Promise.reject(new UnauthorizedError(''));
1217
1217
  }
1218
1218
  return getToken(ctx);
1219
1219
  }
@@ -2137,8 +2137,7 @@ class Centrifuge extends EventEmitter$1 {
2137
2137
  getSubscription(channel) {
2138
2138
  return this._getSub(channel);
2139
2139
  }
2140
- /** removeSubscription allows removing Subcription from the internal registry. Subscrption
2141
- * must be in unsubscribed state. */
2140
+ /** removeSubscription allows removing Subcription from the internal registry. */
2142
2141
  removeSubscription(sub) {
2143
2142
  if (!sub) {
2144
2143
  return;
@@ -3184,7 +3183,7 @@ class Centrifuge extends EventEmitter$1 {
3184
3183
  message: 'token expired but no getToken function set in the configuration'
3185
3184
  }
3186
3185
  });
3187
- throw new UnauthorizedError('');
3186
+ return Promise.reject(new UnauthorizedError(''));
3188
3187
  }
3189
3188
  return this._config.getToken({});
3190
3189
  }
@@ -57,8 +57,7 @@ export declare class Centrifuge extends Centrifuge_base {
57
57
  /** getSubscription returns Subscription if it's registered in the internal
58
58
  * registry or null. */
59
59
  getSubscription(channel: string): Subscription | null;
60
- /** removeSubscription allows removing Subcription from the internal registry. Subscrption
61
- * must be in unsubscribed state. */
60
+ /** removeSubscription allows removing Subcription from the internal registry. */
62
61
  removeSubscription(sub: Subscription | null): void;
63
62
  /** Get a map with all current client-side subscriptions. */
64
63
  subscriptions(): Record<string, Subscription>;