@telestack/db-sdk 1.0.2 → 1.0.4

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 (2) hide show
  1. package/dist/index.js +8 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -428,7 +428,10 @@ export class Query {
428
428
  if (!centrifuge)
429
429
  return () => { };
430
430
  const channel = `collection:${this.path.replace(/\//g, '_')}`;
431
- const sub = centrifuge.newSubscription(channel);
431
+ let sub = centrifuge.getSubscription(channel);
432
+ if (!sub) {
433
+ sub = centrifuge.newSubscription(channel);
434
+ }
432
435
  const debouncedCallback = () => {
433
436
  if (this.debounceTimer)
434
437
  clearTimeout(this.debounceTimer);
@@ -498,7 +501,10 @@ export class Query {
498
501
  if (!centrifuge)
499
502
  return () => { };
500
503
  const channel = `collection:${this.path.replace(/\//g, '_')}`;
501
- const sub = centrifuge.newSubscription(channel);
504
+ let sub = centrifuge.getSubscription(channel);
505
+ if (!sub) {
506
+ sub = centrifuge.newSubscription(channel);
507
+ }
502
508
  sub.on('join', (ctx) => {
503
509
  callback({ action: 'join', user: ctx.info.user, clientId: ctx.info.client });
504
510
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telestack/db-sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Fluent, real-time SDK for Telestack DB",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",