Skip to content

Commit d78147d

Browse files
PubNub SDK v9.11.0 release.
1 parent b8d77a5 commit d78147d

File tree

11 files changed

+90
-25
lines changed

11 files changed

+90
-25
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-09-18
4+
version: v9.11.0
5+
changes:
6+
- type: feature
7+
text: "Add 'limit' and 'offset' parameters for 'HereNowRequest' for pagination support."
38
- date: 2025-09-09
49
version: v9.10.0
510
changes:
@@ -1335,7 +1340,7 @@ supported-platforms:
13351340
- 'Ubuntu 14.04 and up'
13361341
- 'Windows 7 and up'
13371342
version: 'Pubnub Javascript for Node'
1338-
version: '9.10.0'
1343+
version: '9.11.0'
13391344
sdks:
13401345
- full-name: PubNub Javascript SDK
13411346
short-name: Javascript
@@ -1351,7 +1356,7 @@ sdks:
13511356
- distribution-type: source
13521357
distribution-repository: GitHub release
13531358
package-name: pubnub.js
1354-
location: https://github.com/pubnub/javascript/archive/refs/tags/v9.10.0.zip
1359+
location: https://github.com/pubnub/javascript/archive/refs/tags/v9.11.0.zip
13551360
requires:
13561361
- name: 'agentkeepalive'
13571362
min-version: '3.5.2'
@@ -2022,7 +2027,7 @@ sdks:
20222027
- distribution-type: library
20232028
distribution-repository: GitHub release
20242029
package-name: pubnub.js
2025-
location: https://github.com/pubnub/javascript/releases/download/v9.10.0/pubnub.9.10.0.js
2030+
location: https://github.com/pubnub/javascript/releases/download/v9.11.0/pubnub.9.11.0.js
20262031
requires:
20272032
- name: 'agentkeepalive'
20282033
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+
## v9.11.0
2+
September 18 2025
3+
4+
#### Added
5+
- Add 'limit' and 'offset' parameters for 'HereNowRequest' for pagination support.
6+
17
## v9.10.0
28
September 09 2025
39

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.10.0.js
31-
* https://cdn.pubnub.com/sdk/javascript/pubnub.9.10.0.min.js
30+
* https://cdn.pubnub.com/sdk/javascript/pubnub.9.11.0.js
31+
* https://cdn.pubnub.com/sdk/javascript/pubnub.9.11.0.min.js
3232
3333
2. Configure your keys:
3434

dist/web/pubnub.js

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5436,7 +5436,7 @@
54365436
return base.PubNubFile;
54375437
},
54385438
get version() {
5439-
return '9.10.0';
5439+
return '9.11.0';
54405440
},
54415441
getVersion() {
54425442
return this.version;
@@ -11420,6 +11420,10 @@
1142011420
* Whether state associated with `uuid` should be included in response or not.
1142111421
*/
1142211422
const INCLUDE_STATE = false;
11423+
/**
11424+
* Maximum number of participants which can be returned with single response.
11425+
*/
11426+
const MAXIMUM_COUNT = 1000;
1142311427
// endregion
1142411428
/**
1142511429
* Channel presence request.
@@ -11428,14 +11432,19 @@
1142811432
*/
1142911433
class HereNowRequest extends AbstractRequest {
1143011434
constructor(parameters) {
11431-
var _a, _b, _c;
11432-
var _d, _e, _f;
11435+
var _a, _b, _c, _d;
11436+
var _e, _f, _g, _h;
1143311437
super();
1143411438
this.parameters = parameters;
1143511439
// Apply defaults.
11436-
(_a = (_d = this.parameters).queryParameters) !== null && _a !== void 0 ? _a : (_d.queryParameters = {});
11437-
(_b = (_e = this.parameters).includeUUIDs) !== null && _b !== void 0 ? _b : (_e.includeUUIDs = INCLUDE_UUID$1);
11438-
(_c = (_f = this.parameters).includeState) !== null && _c !== void 0 ? _c : (_f.includeState = INCLUDE_STATE);
11440+
(_a = (_e = this.parameters).queryParameters) !== null && _a !== void 0 ? _a : (_e.queryParameters = {});
11441+
(_b = (_f = this.parameters).includeUUIDs) !== null && _b !== void 0 ? _b : (_f.includeUUIDs = INCLUDE_UUID$1);
11442+
(_c = (_g = this.parameters).includeState) !== null && _c !== void 0 ? _c : (_g.includeState = INCLUDE_STATE);
11443+
if (this.parameters.limit)
11444+
this.parameters.limit = Math.min(this.parameters.limit, MAXIMUM_COUNT);
11445+
else
11446+
this.parameters.limit = MAXIMUM_COUNT;
11447+
(_d = (_h = this.parameters).offset) !== null && _d !== void 0 ? _d : (_h.offset = 0);
1143911448
}
1144011449
operation() {
1144111450
const { channels = [], channelGroups = [] } = this.parameters;
@@ -11480,6 +11489,7 @@
1148011489
return {
1148111490
totalChannels,
1148211491
totalOccupancy,
11492+
next: 0,
1148311493
channels: channelsPresence,
1148411494
};
1148511495
});
@@ -11492,8 +11502,8 @@
1149211502
return path;
1149311503
}
1149411504
get queryParameters() {
11495-
const { channelGroups, includeUUIDs, includeState, queryParameters } = this.parameters;
11496-
return Object.assign(Object.assign(Object.assign(Object.assign({}, (!includeUUIDs ? { disable_uuids: '1' } : {})), ((includeState !== null && includeState !== void 0 ? includeState : false) ? { state: '1' } : {})), (channelGroups && channelGroups.length > 0 ? { 'channel-group': channelGroups.join(',') } : {})), queryParameters);
11505+
const { channelGroups, includeUUIDs, includeState, limit, offset, queryParameters } = this.parameters;
11506+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (this.operation() === RequestOperation$1.PNHereNowOperation ? { limit } : {})), (this.operation() === RequestOperation$1.PNHereNowOperation && offset > 0 ? { offset } : {})), (!includeUUIDs ? { disable_uuids: '1' } : {})), ((includeState !== null && includeState !== void 0 ? includeState : false) ? { state: '1' } : {})), (channelGroups && channelGroups.length > 0 ? { 'channel-group': channelGroups.join(',') } : {})), queryParameters);
1149711507
}
1149811508
}
1149911509

@@ -16768,10 +16778,16 @@
1676816778
};
1676916779
if (callback)
1677016780
return this.sendRequest(request, (status, response) => {
16781+
var _a;
16782+
if (response && response.totalOccupancy === parameters.limit)
16783+
response.next = ((_a = parameters.offset) !== null && _a !== void 0 ? _a : 0) + 1;
1677116784
logResponse(response);
1677216785
callback(status, response);
1677316786
});
1677416787
return this.sendRequest(request).then((response) => {
16788+
var _a;
16789+
if (response && response.totalOccupancy === parameters.limit)
16790+
response.next = ((_a = parameters.offset) !== null && _a !== void 0 ? _a : 0) + 1;
1677516791
logResponse(response);
1677616792
return response;
1677716793
});

dist/web/pubnub.min.js

Lines changed: 2 additions & 2 deletions
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
@@ -168,7 +168,7 @@ const makeConfiguration = (base, setupCryptoModule) => {
168168
return base.PubNubFile;
169169
},
170170
get version() {
171-
return '9.10.0';
171+
return '9.11.0';
172172
},
173173
getVersion() {
174174
return this.version;

lib/core/endpoints/presence/here_now.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ const INCLUDE_UUID = true;
3333
* Whether state associated with `uuid` should be included in response or not.
3434
*/
3535
const INCLUDE_STATE = false;
36+
/**
37+
* Maximum number of participants which can be returned with single response.
38+
*/
39+
const MAXIMUM_COUNT = 1000;
3640
// endregion
3741
/**
3842
* Channel presence request.
@@ -41,14 +45,19 @@ const INCLUDE_STATE = false;
4145
*/
4246
class HereNowRequest extends request_1.AbstractRequest {
4347
constructor(parameters) {
44-
var _a, _b, _c;
45-
var _d, _e, _f;
48+
var _a, _b, _c, _d;
49+
var _e, _f, _g, _h;
4650
super();
4751
this.parameters = parameters;
4852
// Apply defaults.
49-
(_a = (_d = this.parameters).queryParameters) !== null && _a !== void 0 ? _a : (_d.queryParameters = {});
50-
(_b = (_e = this.parameters).includeUUIDs) !== null && _b !== void 0 ? _b : (_e.includeUUIDs = INCLUDE_UUID);
51-
(_c = (_f = this.parameters).includeState) !== null && _c !== void 0 ? _c : (_f.includeState = INCLUDE_STATE);
53+
(_a = (_e = this.parameters).queryParameters) !== null && _a !== void 0 ? _a : (_e.queryParameters = {});
54+
(_b = (_f = this.parameters).includeUUIDs) !== null && _b !== void 0 ? _b : (_f.includeUUIDs = INCLUDE_UUID);
55+
(_c = (_g = this.parameters).includeState) !== null && _c !== void 0 ? _c : (_g.includeState = INCLUDE_STATE);
56+
if (this.parameters.limit)
57+
this.parameters.limit = Math.min(this.parameters.limit, MAXIMUM_COUNT);
58+
else
59+
this.parameters.limit = MAXIMUM_COUNT;
60+
(_d = (_h = this.parameters).offset) !== null && _d !== void 0 ? _d : (_h.offset = 0);
5261
}
5362
operation() {
5463
const { channels = [], channelGroups = [] } = this.parameters;
@@ -93,6 +102,7 @@ class HereNowRequest extends request_1.AbstractRequest {
93102
return {
94103
totalChannels,
95104
totalOccupancy,
105+
next: 0,
96106
channels: channelsPresence,
97107
};
98108
});
@@ -105,8 +115,8 @@ class HereNowRequest extends request_1.AbstractRequest {
105115
return path;
106116
}
107117
get queryParameters() {
108-
const { channelGroups, includeUUIDs, includeState, queryParameters } = this.parameters;
109-
return Object.assign(Object.assign(Object.assign(Object.assign({}, (!includeUUIDs ? { disable_uuids: '1' } : {})), ((includeState !== null && includeState !== void 0 ? includeState : false) ? { state: '1' } : {})), (channelGroups && channelGroups.length > 0 ? { 'channel-group': channelGroups.join(',') } : {})), queryParameters);
118+
const { channelGroups, includeUUIDs, includeState, limit, offset, queryParameters } = this.parameters;
119+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (this.operation() === operations_1.default.PNHereNowOperation ? { limit } : {})), (this.operation() === operations_1.default.PNHereNowOperation && offset > 0 ? { offset } : {})), (!includeUUIDs ? { disable_uuids: '1' } : {})), ((includeState !== null && includeState !== void 0 ? includeState : false) ? { state: '1' } : {})), (channelGroups && channelGroups.length > 0 ? { 'channel-group': channelGroups.join(',') } : {})), queryParameters);
110120
}
111121
}
112122
exports.HereNowRequest = HereNowRequest;

lib/core/pubnub-common.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,10 +1701,16 @@ class PubNubCore {
17011701
};
17021702
if (callback)
17031703
return this.sendRequest(request, (status, response) => {
1704+
var _a;
1705+
if (response && response.totalOccupancy === parameters.limit)
1706+
response.next = ((_a = parameters.offset) !== null && _a !== void 0 ? _a : 0) + 1;
17041707
logResponse(response);
17051708
callback(status, response);
17061709
});
17071710
return this.sendRequest(request).then((response) => {
1711+
var _a;
1712+
if (response && response.totalOccupancy === parameters.limit)
1713+
response.next = ((_a = parameters.offset) !== null && _a !== void 0 ? _a : 0) + 1;
17081714
logResponse(response);
17091715
return response;
17101716
});

lib/types/index.d.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7182,6 +7182,20 @@ declare namespace PubNub {
71827182
* @default `false`.
71837183
*/
71847184
includeState?: boolean;
7185+
/**
7186+
* Limit the number of results returned.
7187+
*
7188+
* **Important:** Maximum value is `1000` users per request.
7189+
*
7190+
* @default `1000`.
7191+
*/
7192+
limit?: number;
7193+
/**
7194+
* Starting position of results to return, used for pagination.
7195+
*
7196+
* @default `0`.
7197+
*/
7198+
offset?: number;
71857199
/**
71867200
* Additional query parameters.
71877201
*/
@@ -7200,6 +7214,14 @@ declare namespace PubNub {
72007214
* Total occupancy for all retrieved channels.
72017215
*/
72027216
totalOccupancy: number;
7217+
/**
7218+
* Next page offset value.
7219+
*
7220+
* Value that could be passed as {@link HereNowParameters.offset|offset} to fetch the next participants list page.
7221+
*
7222+
* **Note:** There are no more pages if the value is set to `0`.
7223+
*/
7224+
next: number;
72037225
/**
72047226
* List of channels to which `uuid` currently subscribed.
72057227
*/

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": "9.10.0",
3+
"version": "9.11.0",
44
"author": "PubNub <[email protected]>",
55
"description": "Publish & Subscribe Real-time Messaging with PubNub",
66
"scripts": {

0 commit comments

Comments
 (0)