Skip to content

Commit 78744e1

Browse files
authored
Fix automatic heartbeatInterval set (#378)
fix(configuration): fix automatic `heartbeatInterval` set Fix issue because of which `heartbeatInterval` wasn't computed if `presenceTimeout` provided during PubNub client configuration
1 parent 26c4d73 commit 78744e1

File tree

12 files changed

+59
-18
lines changed

12 files changed

+59
-18
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: 2024-06-05
4+
version: v8.2.2
5+
changes:
6+
- type: bug
7+
text: "Fix issue because of which `heartbeatInterval` wasn't computed if `presenceTimeout` provided during PubNub client configuration."
38
- date: 2024-05-22
49
version: v8.2.1
510
changes:
@@ -993,7 +998,7 @@ supported-platforms:
993998
- 'Ubuntu 14.04 and up'
994999
- 'Windows 7 and up'
9951000
version: 'Pubnub Javascript for Node'
996-
version: '8.2.1'
1001+
version: '8.2.2'
9971002
sdks:
9981003
- full-name: PubNub Javascript SDK
9991004
short-name: Javascript
@@ -1009,7 +1014,7 @@ sdks:
10091014
- distribution-type: source
10101015
distribution-repository: GitHub release
10111016
package-name: pubnub.js
1012-
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.2.1.zip
1017+
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.2.2.zip
10131018
requires:
10141019
- name: 'agentkeepalive'
10151020
min-version: '3.5.2'
@@ -1680,7 +1685,7 @@ sdks:
16801685
- distribution-type: library
16811686
distribution-repository: GitHub release
16821687
package-name: pubnub.js
1683-
location: https://github.com/pubnub/javascript/releases/download/v8.2.1/pubnub.8.2.1.js
1688+
location: https://github.com/pubnub/javascript/releases/download/v8.2.2/pubnub.8.2.2.js
16841689
requires:
16851690
- name: 'agentkeepalive'
16861691
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.2.2
2+
June 05 2024
3+
4+
#### Fixed
5+
- Fix issue because of which `heartbeatInterval` wasn't computed if `presenceTimeout` provided during PubNub client configuration.
6+
17
## v8.2.1
28
May 22 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.2.1.js
32-
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.2.1.min.js
31+
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.2.2.js
32+
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.2.2.min.js
3333
3434
2. Configure your keys:
3535

dist/web/pubnub.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3525,7 +3525,7 @@
35253525
* @internal
35263526
*/
35273527
const setDefaults$1 = (configuration) => {
3528-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
3528+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
35293529
// Copy configuration.
35303530
const configurationCopy = Object.assign({}, configuration);
35313531
(_a = configurationCopy.logVerbosity) !== null && _a !== void 0 ? _a : (configurationCopy.logVerbosity = USE_VERBOSE_LOGGING);
@@ -3560,7 +3560,10 @@
35603560
// eslint-disable-next-line no-console
35613561
console.log('WARNING: Presence timeout is less than the minimum. Using minimum value: ', PRESENCE_TIMEOUT_MINIMUM);
35623562
}
3563-
(_q = configurationCopy.presenceTimeout) !== null && _q !== void 0 ? _q : (configurationCopy.presenceTimeout = PRESENCE_TIMEOUT);
3563+
if (configurationCopy.presenceTimeout !== undefined)
3564+
configurationCopy.heartbeatInterval = configurationCopy.presenceTimeout / 2 - 1;
3565+
else
3566+
configurationCopy.presenceTimeout = PRESENCE_TIMEOUT;
35643567
// Apply extended configuration defaults.
35653568
let announceSuccessfulHeartbeats = ANNOUNCE_HEARTBEAT_SUCCESS;
35663569
let announceFailedHeartbeats = ANNOUNCE_HEARTBEAT_FAILURE;
@@ -3810,7 +3813,7 @@
38103813
return base.PubNubFile;
38113814
},
38123815
get version() {
3813-
return '8.2.1';
3816+
return '8.2.2';
38143817
},
38153818
getVersion() {
38163819
return this.version;

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
@@ -110,7 +110,7 @@ const makeConfiguration = (base, setupCryptoModule) => {
110110
return base.PubNubFile;
111111
},
112112
get version() {
113-
return '8.2.1';
113+
return '8.2.2';
114114
},
115115
getVersion() {
116116
return this.version;

lib/core/interfaces/configuration.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const PRESENCE_TIMEOUT_MINIMUM = 20;
9494
* @internal
9595
*/
9696
const setDefaults = (configuration) => {
97-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
97+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
9898
// Copy configuration.
9999
const configurationCopy = Object.assign({}, configuration);
100100
(_a = configurationCopy.logVerbosity) !== null && _a !== void 0 ? _a : (configurationCopy.logVerbosity = USE_VERBOSE_LOGGING);
@@ -129,7 +129,10 @@ const setDefaults = (configuration) => {
129129
// eslint-disable-next-line no-console
130130
console.log('WARNING: Presence timeout is less than the minimum. Using minimum value: ', PRESENCE_TIMEOUT_MINIMUM);
131131
}
132-
(_q = configurationCopy.presenceTimeout) !== null && _q !== void 0 ? _q : (configurationCopy.presenceTimeout = PRESENCE_TIMEOUT);
132+
if (configurationCopy.presenceTimeout !== undefined)
133+
configurationCopy.heartbeatInterval = configurationCopy.presenceTimeout / 2 - 1;
134+
else
135+
configurationCopy.presenceTimeout = PRESENCE_TIMEOUT;
133136
// Apply extended configuration defaults.
134137
let announceSuccessfulHeartbeats = ANNOUNCE_HEARTBEAT_SUCCESS;
135138
let announceFailedHeartbeats = ANNOUNCE_HEARTBEAT_FAILURE;

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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.2.1",
3+
"version": "8.2.2",
44
"author": "PubNub <[email protected]>",
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
@@ -169,7 +169,7 @@ export const makeConfiguration = (
169169
return base.PubNubFile;
170170
},
171171
get version(): string {
172-
return '8.2.1';
172+
return '8.2.2';
173173
},
174174
getVersion(): string {
175175
return this.version;

0 commit comments

Comments
 (0)