Skip to content

Commit 1d2ee43

Browse files
mohitpubnubMohit Tejanipubnub-release-bot
authored
feat: enableEventEngine, restore set default (#495)
* set enableEventEngine to true, restore flag to true by default, fix titanium test to equate expected operation type * update subscription_manager: to disable ee, because those tests are subscription_manager component specific, update subscribe tests to in corporate ee changes where EE discard `m` field for handshake, and make presence heartbeat whenever subscribe call made, additional mock request infering to EE http requests * test(time): when ee enabled, the network layer retry kick in with default retry policy, which delayes the failure and hits timeout for failure time call test using mock, unsubscribe.test.ts expects no leave call in certain scenario which is changed intentionally with event engine. * refactor: validation for retry-configuration does not cap maximum retry values * integrate codeRabbit * chore: coderabbit change to not add high level summary * dist/lib updates * mark diconnect and receive failure as subscribe operation type. * PubNub SDK v11.0.0 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 8da3dca commit 1d2ee43

25 files changed

Lines changed: 414 additions & 66 deletions

.coderabbit.yaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
2+
3+
language: en-US
4+
5+
reviews:
6+
# Enable high-level summary of changes
7+
high_level_summary: false
8+
9+
# Add a poem... just kidding, disable it
10+
poem: false
11+
12+
# Collapse walkthrough to keep PR comments clean
13+
collapse_walkthrough: true
14+
15+
# Auto-review on every push
16+
auto_review:
17+
enabled: true
18+
drafts: true
19+
20+
# Path-based review instructions
21+
path_instructions:
22+
- path: "src/core/**"
23+
instructions: |
24+
This is the core SDK module. Pay close attention to:
25+
- Backward compatibility of public API changes
26+
- Proper TypeScript typing (strict mode is enabled)
27+
- No platform-specific code (Node.js, Web, React Native specifics belong in their respective platform directories)
28+
- Thread safety considerations for shared state
29+
- path: "src/core/endpoints/**"
30+
instructions: |
31+
These are REST API endpoint implementations. Review for:
32+
- Correct request/response type definitions
33+
- Proper error handling and status code mapping
34+
- Consistent parameter validation
35+
- Adherence to PubNub REST API contracts
36+
- path: "src/core/types/**"
37+
instructions: |
38+
TypeScript type definitions. Ensure:
39+
- Types are precise and not overly permissive (avoid `any`)
40+
- Exported types maintain backward compatibility
41+
- Proper use of generics and utility types
42+
- path: "src/event-engine/**"
43+
instructions: |
44+
State-machine-based subscription management. Review for:
45+
- Correct state transitions and edge cases
46+
- No leaked subscriptions or event listeners
47+
- Proper cleanup on state exit
48+
- path: "src/entities/**"
49+
instructions: |
50+
High-level subscription API (Channel, ChannelGroup, etc.). Review for:
51+
- Proper event handler lifecycle management
52+
- Memory leak prevention (listener cleanup)
53+
- path: "src/transport/**"
54+
instructions: |
55+
Platform-specific HTTP transport implementations. Review for:
56+
- Proper timeout and cancellation handling
57+
- Correct header management
58+
- Error propagation consistency across platforms
59+
- path: "src/node/**"
60+
instructions: "Node.js platform implementation. Ensure no browser/DOM APIs are used."
61+
- path: "src/web/**"
62+
instructions: "Browser platform implementation. Ensure no Node.js-specific APIs (fs, crypto, etc.) are used."
63+
- path: "src/react_native/**"
64+
instructions: "React Native platform implementation. Verify compatibility with RN runtime."
65+
- path: "test/**"
66+
instructions: |
67+
Test files. Review for:
68+
- Adequate coverage of edge cases
69+
- Proper use of mocks/stubs (Sinon + Nock)
70+
- No flaky patterns (hardcoded timeouts, race conditions)
71+
- Tests that actually assert meaningful behavior
72+
73+
# Tools configuration
74+
tools:
75+
# Enable GitHub checks integration
76+
github-checks:
77+
enabled: true
78+
timeout_ms: 120000
79+
80+
chat:
81+
auto_reply: true
82+
83+
knowledge_base:
84+
mcp:
85+
usage: enabled
86+
87+
# Path filters - ignore generated/vendored/build output
88+
path_filters:
89+
# Build outputs
90+
- "!dist/**"
91+
- "!lib/**"
92+
- "!upload/**"
93+
94+
# Dependencies
95+
- "!node_modules/**"
96+
97+
# Lock files - too noisy, low review value
98+
- "!package-lock.json"
99+
100+
# Config/metadata that rarely needs review
101+
- "!.pubnub.yml"
102+
- "!.vscode/**"
103+
104+
# Generated type bundles
105+
- "!lib/types/**"

.pubnub.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
---
22
changelog:
3+
- date: 2026-04-20
4+
version: v11.0.0
5+
changes:
6+
- type: feature
7+
text: "BREAKING CHANGES: Subscription now uses the event engine workflow by default and automatically restores subscriptions after reconnect."
8+
- type: improvement
9+
text: "Drop `maximumRetry` validation caps for linear/exponential policies."
310
- date: 2026-03-16
411
version: v10.2.9
512
changes:
@@ -1399,7 +1406,7 @@ supported-platforms:
13991406
- 'Ubuntu 14.04 and up'
14001407
- 'Windows 7 and up'
14011408
version: 'Pubnub Javascript for Node'
1402-
version: '10.2.9'
1409+
version: '11.0.0'
14031410
sdks:
14041411
- full-name: PubNub Javascript SDK
14051412
short-name: Javascript
@@ -1415,7 +1422,7 @@ sdks:
14151422
- distribution-type: source
14161423
distribution-repository: GitHub release
14171424
package-name: pubnub.js
1418-
location: https://github.com/pubnub/javascript/archive/refs/tags/v10.2.9.zip
1425+
location: https://github.com/pubnub/javascript/archive/refs/tags/v11.0.0.zip
14191426
requires:
14201427
- name: 'agentkeepalive'
14211428
min-version: '3.5.2'
@@ -2086,7 +2093,7 @@ sdks:
20862093
- distribution-type: library
20872094
distribution-repository: GitHub release
20882095
package-name: pubnub.js
2089-
location: https://github.com/pubnub/javascript/releases/download/v10.2.9/pubnub.10.2.9.js
2096+
location: https://github.com/pubnub/javascript/releases/download/v11.0.0/pubnub.11.0.0.js
20902097
requires:
20912098
- name: 'agentkeepalive'
20922099
min-version: '3.5.2'

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## v11.0.0
2+
April 20 2026
3+
4+
#### Added
5+
- **BREAKING CHANGES**: Subscription now uses the event engine workflow by default and automatically restores subscriptions after reconnect.
6+
7+
#### Modified
8+
- Drop `maximumRetry` validation caps for linear/exponential policies.
9+
110
## v10.2.9
211
March 16 2026
312

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

dist/web/pubnub.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4068,7 +4068,7 @@
40684068
/**
40694069
* Whether PubNub client should catch up subscription after network issues.
40704070
*/
4071-
const RESTORE = false;
4071+
const RESTORE = true;
40724072
/**
40734073
* Whether network availability change should be announced with `PNNetworkDownCategory` and
40744074
* `PNNetworkUpCategory` state or not.
@@ -4089,7 +4089,7 @@
40894089
/**
40904090
* Whether subscription event engine should be used or not.
40914091
*/
4092-
const ENABLE_EVENT_ENGINE = false;
4092+
const ENABLE_EVENT_ENGINE = true;
40934093
/**
40944094
* Whether configured user presence state should be maintained by the PubNub client or not.
40954095
*/
@@ -4991,8 +4991,6 @@
49914991
validate() {
49924992
if (this.delay < 2)
49934993
throw new Error('Delay can not be set less than 2 seconds for retry');
4994-
if (this.maximumRetry > 10)
4995-
throw new Error('Maximum retry for linear retry policy can not be more than 10');
49964994
},
49974995
};
49984996
}
@@ -5017,10 +5015,6 @@
50175015
validate() {
50185016
if (this.minimumDelay < 2)
50195017
throw new Error('Minimum delay can not be set less than 2 seconds for retry');
5020-
else if (this.maximumDelay > 150)
5021-
throw new Error('Maximum delay can not be set more than 150 seconds for' + ' retry');
5022-
else if (this.maximumRetry > 6)
5023-
throw new Error('Maximum retry for exponential retry policy can not be more than 6');
50245018
},
50255019
};
50265020
}
@@ -5438,7 +5432,7 @@
54385432
return base.PubNubFile;
54395433
},
54405434
get version() {
5441-
return '10.2.9';
5435+
return '11.0.0';
54425436
},
54435437
getVersion() {
54445438
return this.version;
@@ -9307,6 +9301,7 @@
93079301
category: StatusCategory$1.PNConnectedCategory,
93089302
affectedChannels: context.channels.slice(0),
93099303
affectedChannelGroups: context.groups.slice(0),
9304+
operation: RequestOperation$1.PNSubscribeOperation,
93109305
currentTimetoken: !!((_d = context.cursor) === null || _d === void 0 ? void 0 : _d.timetoken) ? (_e = context.cursor) === null || _e === void 0 ? void 0 : _e.timetoken : payload.timetoken,
93119306
}),
93129307
]);
@@ -9464,7 +9459,7 @@
94649459
return UnsubscribedState.with(undefined, [
94659460
emitStatus(Object.assign({ category: !payload.isOffline
94669461
? StatusCategory$1.PNDisconnectedCategory
9467-
: StatusCategory$1.PNDisconnectedUnexpectedlyCategory }, (errorCategory ? { error: errorCategory } : {}))),
9462+
: StatusCategory$1.PNDisconnectedUnexpectedlyCategory, operation: RequestOperation$1.PNUnsubscribeOperation }, (errorCategory ? { error: errorCategory } : {}))),
94689463
]);
94699464
}
94709465
return ReceivingState.with({
@@ -9510,20 +9505,29 @@
95109505
var _a;
95119506
if (!event.payload.isOffline) {
95129507
return ReceiveStoppedState.with(Object.assign({}, context), [
9513-
emitStatus({ category: StatusCategory$1.PNDisconnectedCategory }),
9508+
emitStatus({
9509+
category: StatusCategory$1.PNDisconnectedCategory,
9510+
operation: RequestOperation$1.PNSubscribeOperation,
9511+
}),
95149512
]);
95159513
}
95169514
else {
95179515
const errorReason = PubNubAPIError.create(new Error('Network connection error')).toPubNubError(RequestOperation$1.PNSubscribeOperation);
95189516
return ReceiveFailedState.with(Object.assign(Object.assign({}, context), { reason: errorReason }), [
95199517
emitStatus({
95209518
category: StatusCategory$1.PNDisconnectedUnexpectedlyCategory,
9519+
operation: RequestOperation$1.PNSubscribeOperation,
95219520
error: (_a = errorReason.status) === null || _a === void 0 ? void 0 : _a.category,
95229521
}),
95239522
]);
95249523
}
95259524
});
9526-
ReceivingState.on(unsubscribeAll.type, (_) => UnsubscribedState.with(undefined, [emitStatus({ category: StatusCategory$1.PNDisconnectedCategory })]));
9525+
ReceivingState.on(unsubscribeAll.type, (_) => UnsubscribedState.with(undefined, [
9526+
emitStatus({
9527+
category: StatusCategory$1.PNDisconnectedCategory,
9528+
operation: RequestOperation$1.PNUnsubscribeOperation,
9529+
}),
9530+
]));
95279531

95289532
/**
95299533
* Subscribe Event Engine effects dispatcher.

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 '10.2.9';
171+
return '11.0.0';
172172
},
173173
getVersion() {
174174
return this.version;

lib/core/components/retry-policy.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ class RetryPolicy {
153153
validate() {
154154
if (this.delay < 2)
155155
throw new Error('Delay can not be set less than 2 seconds for retry');
156-
if (this.maximumRetry > 10)
157-
throw new Error('Maximum retry for linear retry policy can not be more than 10');
158156
},
159157
};
160158
}
@@ -179,10 +177,6 @@ class RetryPolicy {
179177
validate() {
180178
if (this.minimumDelay < 2)
181179
throw new Error('Minimum delay can not be set less than 2 seconds for retry');
182-
else if (this.maximumDelay > 150)
183-
throw new Error('Maximum delay can not be set more than 150 seconds for' + ' retry');
184-
else if (this.maximumRetry > 6)
185-
throw new Error('Maximum retry for exponential retry policy can not be more than 6');
186180
},
187181
};
188182
}

lib/core/interfaces/configuration.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const USE_SSL = true;
1616
/**
1717
* Whether PubNub client should catch up subscription after network issues.
1818
*/
19-
const RESTORE = false;
19+
const RESTORE = true;
2020
/**
2121
* Whether network availability change should be announced with `PNNetworkDownCategory` and
2222
* `PNNetworkUpCategory` state or not.
@@ -37,7 +37,7 @@ const FILE_PUBLISH_RETRY_LIMIT = 5;
3737
/**
3838
* Whether subscription event engine should be used or not.
3939
*/
40-
const ENABLE_EVENT_ENGINE = false;
40+
const ENABLE_EVENT_ENGINE = true;
4141
/**
4242
* Whether configured user presence state should be maintained by the PubNub client or not.
4343
*/

lib/event-engine/states/handshaking.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ exports.HandshakingState.on(events_1.handshakeSuccess.type, (context, { payload
5656
category: categories_1.default.PNConnectedCategory,
5757
affectedChannels: context.channels.slice(0),
5858
affectedChannelGroups: context.groups.slice(0),
59+
operation: operations_1.default.PNSubscribeOperation,
5960
currentTimetoken: !!((_d = context.cursor) === null || _d === void 0 ? void 0 : _d.timetoken) ? (_e = context.cursor) === null || _e === void 0 ? void 0 : _e.timetoken : payload.timetoken,
6061
}),
6162
]);

0 commit comments

Comments
 (0)