Skip to content

Commit 5d711bc

Browse files
Added limit and offset to HereNow API. (#376)
feat: Added limit and offset parameters for hereNow Added limit and offset parameters for hereNow. Number of returned users per channel by default is limited to 1000. Breaking change fix: Single-channel hereNow with includeUUIDs=false now returns channel data Single-channel hereNow with includeUUIDs=false now returns channel data in the channels map for consistency with multi-channel behaviour. Previously, the channels map was empty in this scenario, forcing reliance on totalOccupancy field only. Breaking change fix: Removed possibility to use deprecated MPNS -Microsoft Push Notification Service. Breaking change. fix: Added deprecation warning for GCP and old APNS PushType. fix: In case FCM is chosen as PushType type REST query param gets fcm value instead of gcm. * PubNub SDK v11.0.0 release. --------- Co-authored-by: PubNub Release Bot <[email protected]>
1 parent e77f620 commit 5d711bc

File tree

29 files changed

+293
-509
lines changed

29 files changed

+293
-509
lines changed

.pubnub.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: kotlin
2-
version: 10.6.0
2+
version: 11.0.0
33
schema: 1
44
scm: github.com/pubnub/kotlin
55
files:
6-
- build/libs/pubnub-kotlin-10.6.0-all.jar
6+
- build/libs/pubnub-kotlin-11.0.0-all.jar
77
sdks:
88
-
99
type: library
@@ -23,8 +23,8 @@ sdks:
2323
-
2424
distribution-type: library
2525
distribution-repository: maven
26-
package-name: pubnub-kotlin-10.6.0
27-
location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-kotlin/10.6.0/pubnub-kotlin-10.6.0.jar
26+
package-name: pubnub-kotlin-11.0.0
27+
location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-kotlin/11.0.0/pubnub-kotlin-11.0.0.jar
2828
supported-platforms:
2929
supported-operating-systems:
3030
Android:
@@ -121,6 +121,19 @@ sdks:
121121
license-url: https://www.apache.org/licenses/LICENSE-2.0.txt
122122
is-required: Required
123123
changelog:
124+
- date: 2025-10-21
125+
version: v11.0.0
126+
changes:
127+
- type: feature
128+
text: "Added limit and offset parameters for hereNow. Number of returned users per channel by default is limited to 1000. Breaking change."
129+
- type: bug
130+
text: "Single-channel hereNow with includeUUIDs=false now returns channel data in the channels map for consistency with multi-channel behaviour. Previously, the channels map was empty in this scenario, forcing reliance on totalOccupancy field only. Breaking change."
131+
- type: bug
132+
text: "Removed possibility to use deprecated MPNS -Microsoft Push Notification Service. Breaking change."
133+
- type: bug
134+
text: "Added deprecation warning for GCP and old APNS PushType. ."
135+
- type: bug
136+
text: "In case FCM is chosen as PushType type REST query param gets fcm value instead of gcm."
124137
- date: 2025-09-11
125138
version: v10.6.0
126139
changes:

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## v11.0.0
2+
October 21 2025
3+
4+
#### Added
5+
- Added limit and offset parameters for hereNow. Number of returned users per channel by default is limited to 1000. Breaking change.
6+
7+
#### Fixed
8+
- Single-channel hereNow with includeUUIDs=false now returns channel data in the channels map for consistency with multi-channel behaviour. Previously, the channels map was empty in this scenario, forcing reliance on totalOccupancy field only. Breaking change.
9+
- Removed possibility to use deprecated MPNS -Microsoft Push Notification Service. Breaking change.
10+
- Added deprecation warning for GCP and old APNS PushType. .
11+
- In case FCM is chosen as PushType type REST query param gets fcm value instead of gcm.
12+
113
## v10.6.0
214
September 11 2025
315

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ You will need the publish and subscribe keys to authenticate your app. Get your
2020
<dependency>
2121
<groupId>com.pubnub</groupId>
2222
<artifactId>pubnub-kotlin</artifactId>
23-
<version>10.6.0</version>
23+
<version>11.0.0</version>
2424
</dependency>
2525
```
2626

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RELEASE_SIGNING_ENABLED=true
1818
SONATYPE_HOST=DEFAULT
1919
SONATYPE_AUTOMATIC_RELEASE=false
2020
GROUP=com.pubnub
21-
VERSION_NAME=10.6.0
21+
VERSION_NAME=11.0.0
2222
POM_PACKAGING=jar
2323

2424
POM_NAME=PubNub SDK

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dokka = "2.0.0"
1313
kotlinx_datetime = "0.6.2"
1414
kotlinx_coroutines = "1.10.2"
1515
pubnub_js = "10.1.0"
16-
pubnub_swift = "9.3.2"
16+
pubnub_swift = "9.3.5"
1717

1818
[libraries]
1919
retrofit2 = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit2" }

pubnub-gson/pubnub-gson-api/src/main/java/com/pubnub/api/java/endpoints/presence/HereNow.java

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,79 @@
33
import com.pubnub.api.java.endpoints.Endpoint;
44
import com.pubnub.api.models.consumer.presence.PNHereNowResult;
55

6+
/**
7+
* Obtain information about the current state of channels including a list of unique user IDs
8+
* currently subscribed and the total occupancy count.
9+
* <p>
10+
*
11+
* @see com.pubnub.api.models.consumer.presence.PNHereNowResult
12+
*/
613
public interface HereNow extends Endpoint<PNHereNowResult> {
14+
/**
15+
* Set the channels to query for presence information.
16+
*
17+
* @param channels List of channel names to query.
18+
* @return {@code this} for method chaining
19+
* @see #channelGroups(java.util.List)
20+
*/
721
HereNow channels(java.util.List<String> channels);
822

23+
/**
24+
* Set the channel groups to query for presence information.
25+
*
26+
* @param channelGroups List of channel group names to query.
27+
* @return {@code this} for method chaining
28+
* @see #channels(java.util.List)
29+
*/
930
HereNow channelGroups(java.util.List<String> channelGroups);
1031

32+
/**
33+
* Whether the response should include presence state information, if available.
34+
*
35+
* @param includeState {@code true} to include state information, {@code false} to exclude. Default: {@code false}
36+
* @return {@code this} for method chaining
37+
* @see #includeUUIDs(boolean)
38+
*/
1139
HereNow includeState(boolean includeState);
1240

41+
/**
42+
* Include the list of UUIDs currently present in each channel.
43+
*
44+
* @param includeUUIDs {@code true} to include UUID list, {@code false} for occupancy count only. Default: {@code true}
45+
* @return {@code this} for method chaining
46+
* @see #includeState(boolean)
47+
* @see #limit(int)
48+
*/
1349
HereNow includeUUIDs(boolean includeUUIDs);
1450

51+
/**
52+
* Set the maximum number of occupants to return per channel.
53+
* <p>
54+
* The server enforces a maximum limit of 1000. Values outside this range will be rejected by the server.
55+
* <p>
56+
* Special behavior:
57+
* <ul>
58+
* <li>Use {@code limit = 0} to retrieve only occupancy counts without individual occupant UUIDs</li>
59+
* </ul>
60+
*
61+
* @param limit Maximum number of occupants to return (0-1000). Default: 1000
62+
* @return {@code this} for method chaining
63+
* @see #offset(Integer) for pagination support
64+
*/
1565
HereNow limit(int limit);
1666

67+
/**
68+
* Set the zero-based starting index for pagination through occupants.
69+
* <p>
70+
* Server-side validation applies:
71+
* <ul>
72+
* <li>Must be >= 0 (negative values will be rejected)</li>
73+
* </ul>
74+
* <p>
75+
*
76+
* @param offset Zero-based starting position (must be >= 0). Default: null (no offset)
77+
* @return {@code this} for method chaining
78+
* @see #limit(int) for controlling result size
79+
*/
1780
HereNow offset(Integer offset);
1881
}

pubnub-gson/pubnub-gson-impl/src/integrationTest/java/com/pubnub/api/integration/PushIntegrationTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ protected void onBefore() {
4444
public void testEnumNames() {
4545
assertEquals("apns", PNPushType.APNS.toString());
4646
assertEquals("gcm", PNPushType.GCM.toString());
47-
assertEquals("gcm", PNPushType.FCM.toString());
48-
assertEquals("mpns", PNPushType.MPNS.toString());
47+
assertEquals("fcm", PNPushType.FCM.toString());
4948
assertEquals("apns2", PNPushType.APNS2.toString());
5049
}
5150

pubnub-kotlin/pubnub-kotlin-api/config/ktlint/baseline.xml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,25 @@
2323
<error line="1177" column="13" source="standard:property-naming" />
2424
<error line="1179" column="13" source="standard:property-naming" />
2525
<error line="1242" column="39" source="standard:comment-wrapping" />
26-
<error line="1327" column="15" source="standard:class-naming" />
27-
<error line="1355" column="42" source="standard:comment-wrapping" />
28-
<error line="1405" column="37" source="standard:comment-wrapping" />
29-
<error line="1426" column="13" source="standard:property-naming" />
30-
<error line="1427" column="13" source="standard:property-naming" />
31-
<error line="1431" column="13" source="standard:property-naming" />
32-
<error line="1432" column="13" source="standard:property-naming" />
33-
<error line="1451" column="9" source="standard:property-naming" />
34-
<error line="1452" column="9" source="standard:property-naming" />
35-
<error line="1453" column="9" source="standard:property-naming" />
26+
<error line="1317" column="15" source="standard:class-naming" />
27+
<error line="1343" column="42" source="standard:comment-wrapping" />
28+
<error line="1393" column="37" source="standard:comment-wrapping" />
29+
<error line="1414" column="13" source="standard:property-naming" />
30+
<error line="1415" column="13" source="standard:property-naming" />
31+
<error line="1419" column="13" source="standard:property-naming" />
32+
<error line="1420" column="13" source="standard:property-naming" />
33+
<error line="1439" column="9" source="standard:property-naming" />
34+
<error line="1440" column="9" source="standard:property-naming" />
35+
<error line="1441" column="9" source="standard:property-naming" />
36+
<error line="1442" column="9" source="standard:property-naming" />
37+
<error line="1443" column="9" source="standard:property-naming" />
38+
<error line="1444" column="9" source="standard:property-naming" />
39+
<error line="1445" column="9" source="standard:property-naming" />
40+
<error line="1446" column="9" source="standard:property-naming" />
41+
<error line="1447" column="9" source="standard:property-naming" />
42+
<error line="1448" column="9" source="standard:property-naming" />
43+
<error line="1449" column="9" source="standard:property-naming" />
44+
<error line="1450" column="9" source="standard:property-naming" />
3645
<error line="1454" column="9" source="standard:property-naming" />
3746
<error line="1455" column="9" source="standard:property-naming" />
3847
<error line="1456" column="9" source="standard:property-naming" />
@@ -42,6 +51,9 @@
4251
<error line="1460" column="9" source="standard:property-naming" />
4352
<error line="1461" column="9" source="standard:property-naming" />
4453
<error line="1462" column="9" source="standard:property-naming" />
54+
<error line="1463" column="9" source="standard:property-naming" />
55+
<error line="1464" column="9" source="standard:property-naming" />
56+
<error line="1465" column="9" source="standard:property-naming" />
4557
<error line="1466" column="9" source="standard:property-naming" />
4658
<error line="1467" column="9" source="standard:property-naming" />
4759
<error line="1468" column="9" source="standard:property-naming" />
@@ -66,17 +78,5 @@
6678
<error line="1487" column="9" source="standard:property-naming" />
6779
<error line="1488" column="9" source="standard:property-naming" />
6880
<error line="1489" column="9" source="standard:property-naming" />
69-
<error line="1490" column="9" source="standard:property-naming" />
70-
<error line="1491" column="9" source="standard:property-naming" />
71-
<error line="1492" column="9" source="standard:property-naming" />
72-
<error line="1493" column="9" source="standard:property-naming" />
73-
<error line="1494" column="9" source="standard:property-naming" />
74-
<error line="1495" column="9" source="standard:property-naming" />
75-
<error line="1496" column="9" source="standard:property-naming" />
76-
<error line="1497" column="9" source="standard:property-naming" />
77-
<error line="1498" column="9" source="standard:property-naming" />
78-
<error line="1499" column="9" source="standard:property-naming" />
79-
<error line="1500" column="9" source="standard:property-naming" />
80-
<error line="1501" column="9" source="standard:property-naming" />
8181
</file>
8282
</baseline>

pubnub-kotlin/pubnub-kotlin-api/src/jsMain/kotlin/Pubnub.d.kt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,16 +1307,6 @@ open external class PubNub(config: Any /* UUID | UserId */) {
13071307
var isSilent: Boolean
13081308
}
13091309

1310-
interface MPNSNotificationPayload : BaseNotificationPayload {
1311-
var backContent: String?
1312-
1313-
var backTitle: String?
1314-
1315-
var count: Number?
1316-
1317-
var type: String?
1318-
}
1319-
13201310
interface FCMNotificationPayload : BaseNotificationPayload {
13211311
var isSilent: Boolean
13221312
var icon: String?
@@ -1326,7 +1316,6 @@ open external class PubNub(config: Any /* UUID | UserId */) {
13261316

13271317
interface `T$37` {
13281318
var apns: Any?
1329-
var mpns: Any?
13301319
var fcm: Any?
13311320
}
13321321

@@ -1344,7 +1333,6 @@ open external class PubNub(config: Any /* UUID | UserId */) {
13441333
var body: String?
13451334

13461335
var apns: APNSNotificationPayload
1347-
var mpns: MPNSNotificationPayload
13481336
var fcm: FCMNotificationPayload
13491337

13501338
fun buildPayload(platforms: Array<String>): Any?

pubnub-kotlin/pubnub-kotlin-api/src/jvmMain/kotlin/com/pubnub/api/PubNub.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ actual interface PubNub : StatusEmitter, EventEmitter {
492492
/**
493493
* Enable push notifications on provided set of channels.
494494
*
495-
* @param pushType Accepted values: FCM, APNS, MPNS, APNS2.
495+
* @param pushType Accepted values: FCM, APNS2.
496496
* @see [PNPushType]
497497
* @param channels Channels to add push notifications to.
498498
* @param deviceId The device ID (token) to associate with push notifications.
@@ -512,7 +512,7 @@ actual interface PubNub : StatusEmitter, EventEmitter {
512512
/**
513513
* Request a list of all channels on which push notifications have been enabled using specified [ListPushProvisions.deviceId].
514514
*
515-
* @param pushType Accepted values: FCM, APNS, MPNS, APNS2. @see [PNPushType]
515+
* @param pushType Accepted values: FCM, APNS2. @see [PNPushType]
516516
* @param deviceId The device ID (token) to associate with push notifications.
517517
* @param environment Environment within which device should manage list of channels with enabled notifications
518518
* (works only if [pushType] set to [PNPushType.APNS2]).
@@ -529,7 +529,7 @@ actual interface PubNub : StatusEmitter, EventEmitter {
529529
/**
530530
* Disable push notifications on provided set of channels.
531531
*
532-
* @param pushType Accepted values: FCM, APNS, MPNS, APNS2. @see [PNPushType]
532+
* @param pushType Accepted values: FCM, APNS2. @see [PNPushType]
533533
* @param channels Channels to remove push notifications from.
534534
* @param deviceId The device ID (token) associated with push notifications.
535535
* @param environment Environment within which device should manage list of channels with enabled notifications
@@ -548,7 +548,7 @@ actual interface PubNub : StatusEmitter, EventEmitter {
548548
/**
549549
* Disable push notifications from all channels registered with the specified [RemoveAllPushChannelsForDevice.deviceId].
550550
*
551-
* @param pushType Accepted values: FCM, APNS, MPNS, APNS2. @see [PNPushType]
551+
* @param pushType Accepted values: FCM, APNS2. @see [PNPushType]
552552
* @param deviceId The device ID (token) to associate with push notifications.
553553
* @param environment Environment within which device should manage list of channels with enabled notifications
554554
* (works only if [pushType] set to [PNPushType.APNS2]).
@@ -771,12 +771,8 @@ actual interface PubNub : StatusEmitter, EventEmitter {
771771
* @param limit Maximum number of occupants to return per channel. Valid range: 0-1000.
772772
* - Default: 1000
773773
* - Use 0 to get occupancy counts without user details
774-
* - Values outside the valid range are automatically adjusted to 1000 with a warning log
775774
* @param offset Zero-based starting index for pagination. Returns occupants starting from this position in the list. Must be >= 0.
776775
* - Default: null (no offset)
777-
* - Requires limit > 0 (throws [PubNubException] with [PubNubError.HERE_NOW_OFFSET_REQUIRES_LIMIT_HIGHER_THAN_0] if limit is 0)
778-
* - Use with limit to paginate through large user lists
779-
* - Throws [PubNubException] with [PubNubError.HERE_NOW_OFFSET_OUT_OF_RANGE] if negative
780776
*/
781777
actual fun hereNow(
782778
channels: List<String>,

0 commit comments

Comments
 (0)