Skip to content

Commit

Permalink
Fix subscribe request aggregation in SharedWorker. (#403)
Browse files Browse the repository at this point in the history
fix(shared-worker): fix presence leave request preparation

Fix issue because of which leave request modified wrong URL path component with actual channels.

fix(shared-worker): fix channels / groups list modification issues

Fix issue because of which removed channels / groups didn't cancel previous subscribe request to
re-subscribe with new set of channels / groups.

fix(shared-worker): fix requests aggregation issues

Fix issue because of which suitable active PubNub clients subscription not has been used for
aggregation and caused additional connections or wrong set of channels / groups.

refactor(subscription): process messages only for subscribed

Pre-process entries from subscribe response to filter out updates which has been received for
channels and groups which are not part of subscription loop (subscription aggregation in shared
worker).

refactor(package): add `types` entry for Node.js integration

Point to the built-in types definition file when package used with npm / yarn.

---------

Co-authored-by: Mohit Tejani <[email protected]>
Co-authored-by: PubNub Release Bot <[email protected]>
  • Loading branch information
3 people authored Sep 30, 2024
1 parent bc85e1d commit 0beda2c
Show file tree
Hide file tree
Showing 15 changed files with 689 additions and 196 deletions.
19 changes: 16 additions & 3 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
---
changelog:
- date: 2024-09-30
version: v8.2.8
changes:
- type: bug
text: "Fix issue because of which leave request modified wrong URL path component with actual channels."
- type: bug
text: "Fix issue because of which removed channels / groups didn't cancel previous subscribe request to re-subscribe with new set of channels / groups."
- type: bug
text: "Fix issue because of which suitable active PubNub clients subscription not has been used for aggregation and caused additional connections or wrong set of channels / groups."
- type: improvement
text: "Pre-process entries from subscribe response to filter out updates which has been received for channels and groups which are not part of subscription loop (subscription aggregation in shared worker)."
- type: improvement
text: "Point to the built-in types definition file when package used with `npm` / `yarn`."
- date: 2024-08-01
version: v8.2.7
changes:
Expand Down Expand Up @@ -1023,7 +1036,7 @@ supported-platforms:
- 'Ubuntu 14.04 and up'
- 'Windows 7 and up'
version: 'Pubnub Javascript for Node'
version: '8.2.7'
version: '8.2.8'
sdks:
- full-name: PubNub Javascript SDK
short-name: Javascript
Expand All @@ -1039,7 +1052,7 @@ sdks:
- distribution-type: source
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.2.7.zip
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.2.8.zip
requires:
- name: 'agentkeepalive'
min-version: '3.5.2'
Expand Down Expand Up @@ -1710,7 +1723,7 @@ sdks:
- distribution-type: library
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/releases/download/v8.2.7/pubnub.8.2.7.js
location: https://github.com/pubnub/javascript/releases/download/v8.2.8/pubnub.8.2.8.js
requires:
- name: 'agentkeepalive'
min-version: '3.5.2'
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## v8.2.8
September 30 2024

#### Fixed
- Fix issue because of which leave request modified wrong URL path component with actual channels.
- Fix issue because of which removed channels / groups didn't cancel previous subscribe request to re-subscribe with new set of channels / groups.
- Fix issue because of which suitable active PubNub clients subscription not has been used for aggregation and caused additional connections or wrong set of channels / groups.

#### Modified
- Pre-process entries from subscribe response to filter out updates which has been received for channels and groups which are not part of subscription loop (subscription aggregation in shared worker).
- Point to the built-in types definition file when package used with `npm` / `yarn`.

## v8.2.7
August 01 2024

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.2.7.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.2.7.min.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.2.8.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.2.8.min.js

2. Configure your keys:

Expand Down
10 changes: 8 additions & 2 deletions dist/web/pubnub.js
Original file line number Diff line number Diff line change
Expand Up @@ -3816,7 +3816,7 @@
return base.PubNubFile;
},
get version() {
return '8.2.7';
return '8.2.8';
},
getVersion() {
return this.version;
Expand Down Expand Up @@ -5868,7 +5868,13 @@
if (!serviceResponse) {
throw new PubNubError('Service response error, check status for details', createValidationError('Unable to deserialize service response'));
}
const events = serviceResponse.m.map((envelope) => {
const events = serviceResponse.m
.filter((envelope) => {
const subscribable = envelope.b === undefined ? envelope.c : envelope.b;
return ((this.parameters.channels && this.parameters.channels.includes(subscribable)) ||
(this.parameters.channelGroups && this.parameters.channelGroups.includes(subscribable)));
})
.map((envelope) => {
let { e: eventType } = envelope;
// Resolve missing event type.
eventType !== null && eventType !== void 0 ? eventType : (eventType = envelope.c.endsWith('-pnpres') ? PubNubEventType.Presence : PubNubEventType.Message);
Expand Down
2 changes: 1 addition & 1 deletion dist/web/pubnub.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 0beda2c

Please sign in to comment.