Skip to content

Commit

Permalink
updated changelog and regenerated dist files
Browse files Browse the repository at this point in the history
  • Loading branch information
ganigeorgiev committed Nov 7, 2022
1 parent f60b2d2 commit 4440e9a
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 7 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
## 0.8.0-rc2

Refactored the realtime handler per [#pocketbase-954](https://github.com/pocketbase/pocketbase/discussions/954#discussioncomment-4071150) to allow registering multiple subscriptions to the same topic.

The collection realtime handler api now is:
```js
// subscribe:
pb.collection("foo").subscribe("*", (e) => {});
pb.collection("foo").subscribe("YOUR_RECORD_ID", (e) => {});

// unsubscribe:
pb.collection("foo").unsubscribe("YOUR_RECORD_ID"); // remove every "YOUR_RECORD_ID" subscription
pb.collection("foo").unsubscribe("*"); // remove every "*" topic subscription
pb.collection("foo").unsubscribe(); // remove every subscription in foo
```
Additionally, `subscribe()` now return `UnsubscribeFunc` that could be used to unsubscribe only from a single subscription listener.

The realtime handler from v0.8.0-rc1 are soft-deprecated and will still work but there will be a console warning to replace them with their newer equivalent.


## 0.8.0-rc1

> **⚠️ This is a pre-release, contains breaking changes and works only with the new PocketBase v0.8+ API!**
Expand Down
2 changes: 1 addition & 1 deletion dist/pocketbase.cjs.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/pocketbase.es.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/pocketbase.es.mjs.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/pocketbase.iife.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/pocketbase.umd.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/services/RealtimeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default class RealtimeService extends BaseService {
// no other active subscriptions -> close the sse connection
this.disconnect();
} else if (!this.hasSubscriptionListeners(topic)) {
// submit subscriptions change if there are other active subscriptions
// submit subscriptions change if there are no other active subscriptions related to the topic
await this.submitSubscriptions();
}
}
Expand Down Expand Up @@ -161,7 +161,7 @@ export default class RealtimeService extends BaseService {
// no other active subscriptions -> close the sse connection
this.disconnect();
} else if (!this.hasSubscriptionListeners(topic)) {
// submit subscriptions change if there are other active subscriptions
// submit subscriptions change if there are no other active subscriptions related to the topic
await this.submitSubscriptions();
}
}
Expand Down

0 comments on commit 4440e9a

Please sign in to comment.