Skip to content

Commit 8bf3d6f

Browse files
parfeonmohitpubnubMohit Tejanipubnub-release-bot
authored
Fix rapid subscribe aggregate (#461)
* fix(shared-worker): fix rapid subscribe aggregate Fix the issue because of which rapid subscription (from other PubNub clients in response to received subscribe response) throttling causes delayed channel list change. refactor(shared-worker): add output of requests processed by the `SharedWorker` Modify the `log` payload for `SharedWorker` to make it possible to log sent / received requests information to the main browser window (not to the SharedWorker console). * feat(shared-worker): emit heartbeat processing status Depending on client configuration, it will emit `status` for heartbeat, which has been started by the `SharedWorker` backup heartbeat timer mechanism. feat(shared-worker): stop `backup` heartbeats on 403 Stop heartbeats until the auth key / access token is changed. On change, `SharedWorker` will send an immediate heartbeat request. refactor(shared-worker): restart `backup` heartbeat on explicit heartbeat Restart the timer of the backup heartbeat if an explicit heartbeat request has been received from the main PubNub client. * fix(subscription-set): fix issue with global subscription set Fix the issue with the global subscription set (used for legacy interface support) because of which `unsubscribe` with the legacy interface wasn't able to complete the unsubscribe process. * refactor(shared-worker): move some logs before request sending To avoid confusion in the logs reading where the message about sending the request appears earlier than it should, move the log output before sending the request. * refactor(shared-worker): announce request sending logs to interested clients Make sure that more clients will receive log messages about request sending (we're limited to a single client for heartbeat requests). refactor(shared-worker): change log message when heartbeat impossible for presence-only channels Change the misleading console message for heartbeat requests, which are scheduled for presence-only (`-pnpres`). * test: subscription/presence behavior with shared-worker (#463) * added karma configuration for sharedworker tests with headless browser, added tests with edge cases for subscribe/unsubscribe with sharedworker * fix: shared worker tests to adapt quick subscription aggregation handling compatible behaviour * test: shared worker subscription aggregation and isolation in message distribution in scenario where messages arrive in one of the aggregated channel entities * test(shared-worker): added test for token management, to test token change behaviour in share worker active subscription * test(shared-worker): added message verification to confirm subscription change, added new test to verify resubscribing to same channel with message reecive check * test(shared-worker): test cleanup, removed debug logs * test(shared-worker) confirm auth token changes through middleware generated request url * test: added test to inspect presence behaviour mimicking tab close activities --------- Co-authored-by: Mohit Tejani <[email protected]> * refactor(shared-worker): incorporate server threshold into heartbeat filter Incorporate a 3-second threshold from the server to the logic that is used to skip heartbeat requests if it has been sent too soon (because the previous one was not so long ago). * fix(shared-worker): fix issue which prevented catchup Fix the condition that, in some cases (burst subscribe from registered clients) incorrectly identified when the initial subscribe REST API response should be patched with catch timetoken. * refactor(shared-worker): re-adjust "backup" timer on early heartbeat Re-adjust "backup" heartbeat timer when one of the clients request sent too early after previous request. * PubNub SDK v9.8.0 release. --------- Co-authored-by: Mohit Tejani <[email protected]> Co-authored-by: Mohit Tejani <[email protected]> Co-authored-by: PubNub Release Bot <[email protected]>
1 parent d44662b commit 8bf3d6f

31 files changed

+4955
-1175
lines changed

.mocharc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"spec": "test/**/*.test.ts",
55
"exclude": [
66
"test/dist/*.{js,ts}",
7-
"test/feature/*.{js,ts}"
7+
"test/feature/*.{js,ts}",
8+
"test/integration/shared-worker/*.{js,ts}"
89
],
910
"timeout": 5000,
1011
"reporter": "spec"

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"parser" : "typescript",
2+
"parser": "typescript",
33
"semi": true,
44
"printWidth": 120,
55
"singleQuote": true,

.pubnub.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
---
22
changelog:
3+
- date: 2025-07-11
4+
version: v9.8.0
5+
changes:
6+
- type: feature
7+
text: "Depending on client configuration, it will emit `status` for heartbeat, which has been started by the `SharedWorker` backup heartbeat timer mechanism."
8+
- type: feature
9+
text: "Stop heartbeats until the auth key / access token is changed. On change, `SharedWorker` will send an immediate heartbeat request."
10+
- type: bug
11+
text: "Fix the issue with the global subscription set (used for legacy interface support) because of which `unsubscribe` with the legacy interface wasn't able to complete the unsubscribe process."
12+
- type: bug
13+
text: "Fix the issue because of which rapid subscription (from other PubNub clients in response to received subscribe response) throttling causes delayed channel list change."
14+
- type: improvement
15+
text: "Restart the timer of the backup heartbeat if an explicit heartbeat request has been received from the main PubNub client."
16+
- type: improvement
17+
text: "Modify the `log` payload for `SharedWorker` to make it possible to log sent / received requests information to the main browser window (not to the `SharedWorker` console)."
318
- date: 2025-06-30
419
version: v9.7.0
520
changes:
@@ -1276,7 +1291,7 @@ supported-platforms:
12761291
- 'Ubuntu 14.04 and up'
12771292
- 'Windows 7 and up'
12781293
version: 'Pubnub Javascript for Node'
1279-
version: '9.7.0'
1294+
version: '9.8.0'
12801295
sdks:
12811296
- full-name: PubNub Javascript SDK
12821297
short-name: Javascript
@@ -1292,7 +1307,7 @@ sdks:
12921307
- distribution-type: source
12931308
distribution-repository: GitHub release
12941309
package-name: pubnub.js
1295-
location: https://github.com/pubnub/javascript/archive/refs/tags/v9.7.0.zip
1310+
location: https://github.com/pubnub/javascript/archive/refs/tags/v9.8.0.zip
12961311
requires:
12971312
- name: 'agentkeepalive'
12981313
min-version: '3.5.2'
@@ -1963,7 +1978,7 @@ sdks:
19631978
- distribution-type: library
19641979
distribution-repository: GitHub release
19651980
package-name: pubnub.js
1966-
location: https://github.com/pubnub/javascript/releases/download/v9.7.0/pubnub.9.7.0.js
1981+
location: https://github.com/pubnub/javascript/releases/download/v9.8.0/pubnub.9.8.0.js
19671982
requires:
19681983
- name: 'agentkeepalive'
19691984
min-version: '3.5.2'

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
## v9.8.0
2+
July 11 2025
3+
4+
#### Added
5+
- Depending on client configuration, it will emit `status` for heartbeat, which has been started by the `SharedWorker` backup heartbeat timer mechanism.
6+
- Stop heartbeats until the auth key / access token is changed. On change, `SharedWorker` will send an immediate heartbeat request.
7+
8+
#### Fixed
9+
- Fix the issue with the global subscription set (used for legacy interface support) because of which `unsubscribe` with the legacy interface wasn't able to complete the unsubscribe process.
10+
- Fix the issue because of which rapid subscription (from other PubNub clients in response to received subscribe response) throttling causes delayed channel list change.
11+
12+
#### Modified
13+
- Restart the timer of the backup heartbeat if an explicit heartbeat request has been received from the main PubNub client.
14+
- Modify the `log` payload for `SharedWorker` to make it possible to log sent / received requests information to the main browser window (not to the `SharedWorker` console).
15+
116
## v9.7.0
217
June 30 2025
318

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ Watch [Getting Started with PubNub JS SDK](https://app.dashcam.io/replay/64ee0d2
2727
npm install pubnub
2828
```
2929
* or download one of our builds from our CDN:
30-
* https://cdn.pubnub.com/sdk/javascript/pubnub.9.7.0.js
31-
* https://cdn.pubnub.com/sdk/javascript/pubnub.9.7.0.min.js
30+
* https://cdn.pubnub.com/sdk/javascript/pubnub.9.8.0.js
31+
* https://cdn.pubnub.com/sdk/javascript/pubnub.9.8.0.min.js
3232
3333
2. Configure your keys:
3434

0 commit comments

Comments
 (0)