Skip to content

Commit 1a2ddeb

Browse files
mohitpubnubMohit Tejanipubnub-release-bot
authored
fix: issue of parsing response for here_now (#427)
* fix: issue of parsing response for here_now * test: additional assert for hereNow response parsing test * PubNub SDK v8.4.1 release. --------- Co-authored-by: Mohit Tejani <mohit.tejani@Mohits-MacBook-Pro.local> Co-authored-by: PubNub Release Bot <120067856+pubnub-release-bot@users.noreply.github.com>
1 parent 6a9fa7d commit 1a2ddeb

File tree

11 files changed

+27
-14
lines changed

11 files changed

+27
-14
lines changed

.pubnub.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
---
22
changelog:
3+
- date: 2025-01-02
4+
version: v8.4.1
5+
changes:
6+
- type: bug
7+
text: "Fixed issue of hereNow response parsing for `totalOccupancy` field."
38
- date: 2024-12-17
49
version: v8.4.0
510
changes:
@@ -1094,7 +1099,7 @@ supported-platforms:
10941099
- 'Ubuntu 14.04 and up'
10951100
- 'Windows 7 and up'
10961101
version: 'Pubnub Javascript for Node'
1097-
version: '8.4.0'
1102+
version: '8.4.1'
10981103
sdks:
10991104
- full-name: PubNub Javascript SDK
11001105
short-name: Javascript
@@ -1110,7 +1115,7 @@ sdks:
11101115
- distribution-type: source
11111116
distribution-repository: GitHub release
11121117
package-name: pubnub.js
1113-
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.4.0.zip
1118+
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.4.1.zip
11141119
requires:
11151120
- name: 'agentkeepalive'
11161121
min-version: '3.5.2'
@@ -1781,7 +1786,7 @@ sdks:
17811786
- distribution-type: library
17821787
distribution-repository: GitHub release
17831788
package-name: pubnub.js
1784-
location: https://github.com/pubnub/javascript/releases/download/v8.4.0/pubnub.8.4.0.js
1789+
location: https://github.com/pubnub/javascript/releases/download/v8.4.1/pubnub.8.4.1.js
17851790
requires:
17861791
- name: 'agentkeepalive'
17871792
min-version: '3.5.2'

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v8.4.1
2+
January 02 2025
3+
4+
#### Fixed
5+
- Fixed issue of hereNow response parsing for `totalOccupancy` field.
6+
17
## v8.4.0
28
December 17 2024
39

README.md

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

dist/web/pubnub.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3961,7 +3961,7 @@
39613961
return base.PubNubFile;
39623962
},
39633963
get version() {
3964-
return '8.4.0';
3964+
return '8.4.1';
39653965
},
39663966
getVersion() {
39673967
return this.version;
@@ -8810,7 +8810,7 @@
88108810
throw PubNubAPIError.create(response);
88118811
// Extract general presence information.
88128812
const totalChannels = 'occupancy' in serviceResponse ? 1 : serviceResponse.payload.total_channels;
8813-
const totalOccupancy = 'occupancy' in serviceResponse ? serviceResponse.occupancy : serviceResponse.payload.total_channels;
8813+
const totalOccupancy = 'occupancy' in serviceResponse ? serviceResponse.occupancy : serviceResponse.payload.total_occupancy;
88148814
const channelsPresence = {};
88158815
let channels = {};
88168816
// Remap single channel presence to multiple channels presence response.

dist/web/pubnub.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/core/components/configuration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const makeConfiguration = (base, setupCryptoModule) => {
112112
return base.PubNubFile;
113113
},
114114
get version() {
115-
return '8.4.0';
115+
return '8.4.1';
116116
},
117117
getVersion() {
118118
return this.version;

lib/core/endpoints/presence/here_now.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class HereNowRequest extends request_1.AbstractRequest {
7373
throw pubnub_api_error_1.PubNubAPIError.create(response);
7474
// Extract general presence information.
7575
const totalChannels = 'occupancy' in serviceResponse ? 1 : serviceResponse.payload.total_channels;
76-
const totalOccupancy = 'occupancy' in serviceResponse ? serviceResponse.occupancy : serviceResponse.payload.total_channels;
76+
const totalOccupancy = 'occupancy' in serviceResponse ? serviceResponse.occupancy : serviceResponse.payload.total_occupancy;
7777
const channelsPresence = {};
7878
let channels = {};
7979
// Remap single channel presence to multiple channels presence response.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pubnub",
3-
"version": "8.4.0",
3+
"version": "8.4.1",
44
"author": "PubNub <support@pubnub.com>",
55
"description": "Publish & Subscribe Real-time Messaging with PubNub",
66
"scripts": {

src/core/components/configuration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export const makeConfiguration = (
171171
return base.PubNubFile;
172172
},
173173
get version(): string {
174-
return '8.4.0';
174+
return '8.4.1';
175175
},
176176
getVersion(): string {
177177
return this.version;

src/core/endpoints/presence/here_now.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export class HereNowRequest extends AbstractRequest<Presence.HereNowResponse> {
165165
// Extract general presence information.
166166
const totalChannels = 'occupancy' in serviceResponse ? 1 : serviceResponse.payload.total_channels;
167167
const totalOccupancy =
168-
'occupancy' in serviceResponse ? serviceResponse.occupancy : serviceResponse.payload.total_channels;
168+
'occupancy' in serviceResponse ? serviceResponse.occupancy : serviceResponse.payload.total_occupancy;
169169
const channelsPresence: Presence.HereNowResponse['channels'] = {};
170170
let channels: Required<MultipleChannelServiceResponse['payload']>['channels'] = {};
171171

test/integration/endpoints/presence.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ describe('presence endpoints', () => {
601601
})
602602
.reply(
603603
200,
604-
' {"status": 200, "message": "OK", "payload": {"channels": {"ch1": {"uuids": ["a581c974-e2f9-4088-9cc8-9632708e012d"], "occupancy": 1}}, "total_channels": 1, "total_occupancy": 1}, "service": "Presence"}',
604+
' {"status": 200, "message": "OK", "payload": {"channels": {"ch1": {"uuids": ["a581c974-e2f9-4088-9cc8-9632708e012d"], "occupancy": 1}}, "total_channels": 3, "total_occupancy": 7}, "service": "Presence"}',
605605
{ 'content-type': 'text/javascript' },
606606
);
607607

@@ -621,6 +621,8 @@ describe('presence endpoints', () => {
621621
]
622622
}
623623
});
624+
assert.equal(response.totalChannels, 3);
625+
assert.equal(response.totalOccupancy, 7);
624626
assert.equal(scope.isDone(), true);
625627
done();
626628
} catch (error) {

0 commit comments

Comments
 (0)