Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
---
changelog:
- date: 2025-01-30
version: v8.7.0
changes:
- type: feature
text: "Pass heartbeat request through `SharedWorker` (if used) to optimize the number of requests for clients opened in few tabs and subscribed on same channels / groups list."
- type: improvement
text: "Don't send `heartbeat` request to unsubscribe."
- date: 2025-01-21
version: v8.6.0
changes:
Expand Down Expand Up @@ -1111,7 +1118,7 @@ supported-platforms:
- 'Ubuntu 14.04 and up'
- 'Windows 7 and up'
version: 'Pubnub Javascript for Node'
version: '8.6.0'
version: '8.7.0'
sdks:
- full-name: PubNub Javascript SDK
short-name: Javascript
Expand All @@ -1127,7 +1134,7 @@ sdks:
- distribution-type: source
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.6.0.zip
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.7.0.zip
requires:
- name: 'agentkeepalive'
min-version: '3.5.2'
Expand Down Expand Up @@ -1798,7 +1805,7 @@ sdks:
- distribution-type: library
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/releases/download/v8.6.0/pubnub.8.6.0.js
location: https://github.com/pubnub/javascript/releases/download/v8.7.0/pubnub.8.7.0.js
requires:
- name: 'agentkeepalive'
min-version: '3.5.2'
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## v8.7.0
January 30 2025

#### Added
- Pass heartbeat request through `SharedWorker` (if used) to optimize the number of requests for clients opened in few tabs and subscribed on same channels / groups list.

#### Modified
- Don't send `heartbeat` request to unsubscribe.

## v8.6.0
January 21 2025

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Watch [Getting Started with PubNub JS SDK](https://app.dashcam.io/replay/64ee0d2
npm install pubnub
```
* or download one of our builds from our CDN:
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.6.0.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.6.0.min.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.7.0.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.7.0.min.js

2. Configure your keys:

Expand Down
21 changes: 15 additions & 6 deletions dist/web/pubnub.js
Original file line number Diff line number Diff line change
Expand Up @@ -3078,7 +3078,7 @@
}
makeSendable(req) {
// Use default request flow for non-subscribe / presence leave requests.
if (!req.path.startsWith('/v2/subscribe') && !req.path.endsWith('/leave'))
if (!req.path.startsWith('/v2/subscribe') && !req.path.endsWith('/heartbeat') && !req.path.endsWith('/leave'))
return this.configuration.transport.makeSendable(req);
let controller;
const sendRequestEvent = {
Expand Down Expand Up @@ -3188,6 +3188,7 @@
clientIdentifier: this.configuration.clientIdentifier,
subscriptionKey: this.configuration.subscriptionKey,
userId: this.configuration.userId,
heartbeatInterval: this.configuration.heartbeatInterval,
logVerbosity: this.configuration.logVerbosity,
workerLogVerbosity: this.configuration.workerLogVerbosity,
}, true);
Expand All @@ -3212,7 +3213,7 @@
else if (data.type === 'shared-worker-console-dir') {
if (data.message)
console.log(`[SharedWorker] ${data.message}`);
console.dir(data.data);
console.dir(data.data, { depth: 10 });
}
else if (data.type === 'shared-worker-ping') {
const { logVerbosity, subscriptionKey, clientIdentifier } = this.configuration;
Expand Down Expand Up @@ -3974,7 +3975,7 @@
return base.PubNubFile;
},
get version() {
return '8.6.0';
return '8.7.0';
},
getVersion() {
return this.version;
Expand Down Expand Up @@ -4708,9 +4709,16 @@
this.stopHeartbeatTimer();
this.reconnectionManager.stopPolling();
}
reconnect() {
/**
* Restart subscription loop with current state.
*
* @param forUnsubscribe - Whether restarting subscription loop as part of channels list change on
* unsubscribe or not.
*/
reconnect(forUnsubscribe = false) {
this.startSubscribeLoop();
this.startHeartbeatTimer();
if (!forUnsubscribe)
this.startHeartbeatTimer();
}
/**
* Update channels and groups used in subscription loop.
Expand Down Expand Up @@ -4809,7 +4817,7 @@
this.region = null;
this.reconnectionManager.stopPolling();
}
this.reconnect();
this.reconnect(true);
}
unsubscribeAll(isOffline) {
this.unsubscribe({
Expand Down Expand Up @@ -14546,6 +14554,7 @@
userId: clientConfiguration.getUserId(),
workerUrl: configurationCopy.subscriptionWorkerUrl,
sdkVersion: clientConfiguration.getVersion(),
heartbeatInterval: clientConfiguration.getHeartbeatInterval(),
logVerbosity: clientConfiguration.logVerbosity,
workerLogVerbosity: platformConfiguration.subscriptionWorkerLogVerbosity,
transport,
Expand Down
4 changes: 2 additions & 2 deletions dist/web/pubnub.min.js

Large diffs are not rendered by default.

Loading
Loading