Skip to content

Commit 69fba7e

Browse files
authored
Release v4.24.1 (#148)
* Update package-lock.json after npm install - David * Fix eslint and prettier errors and typo - David * Setting the default presence heartbeat to false on subscribe - David * Update ESLint rules and fix others - David * Formatting and fixing broken tests - David * Format subscription_manager.test.js and fix tests - David * Format reconnection_manager.test.js and fix tests - David * Update versions and include the build - David * Fix linting errors and rules for Codacy checks - David * Fix broken tests for no longer specified pubnub.yml version - David * Update the date to now - David * Missed version update - David * Subscribe endpoint will send `state` query parameter now. (#147) * fix(subscribe): return 'state' query parameter back Return 'state' back for subscribe endpoint, so client will maintain state information even when heartbeat disabled. * Prettier formatting for Codacy happiness - David * Bumped version to 4.24.1 - David
1 parent 86b5206 commit 69fba7e

19 files changed

+210
-83
lines changed

.pubnub.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
---
22
changelog:
3+
-
4+
changes:
5+
-
6+
text: "Maintains the state when the presence heartbeat is explicitly disabled"
7+
type: improvement
8+
date: 2019-06-06
9+
version: v4.24.1
310
-
411
changes:
512
-
@@ -639,4 +646,4 @@ supported-platforms:
639646
- "Ubuntu 14.04 and above"
640647
- "Windows 7, 8, 10"
641648
version: "Pubnub Javascript for Node"
642-
version: "4.23.0"
649+
version: "4.24.1"

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## [v4.24.1](https://github.com/pubnub/javascript/tree/v4.24.1)
2+
June-06-2019
3+
4+
5+
[Full Changelog](https://github.com/pubnub/javascript/compare/v4.24.0...v4.24.1)
6+
7+
8+
9+
- ⭐ Maintains the state when presence heartbeat is explicitly disabled
10+
11+
12+
113
## [v4.24.0](https://github.com/pubnub/javascript/tree/v4.24.0)
214
May-09-2019
315

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ please use the [master_3x](https://github.com/pubnub/javascript/tree/master_3x)
2222

2323

2424

25-
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.24.0.min.js
26-
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.24.0.js
25+
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.24.1.min.js
26+
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.24.1.js

dist/titanium/pubnub.js

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! 4.24.0 / Consumer */
1+
/*! 4.24.1 / Consumer */
22
(function webpackUniversalModuleDefinition(root, factory) {
33
if(typeof exports === 'object' && typeof module === 'object')
44
module.exports = factory();
@@ -598,7 +598,7 @@ return /******/ (function(modules) { // webpackBootstrap
598598
}, {
599599
key: 'getVersion',
600600
value: function getVersion() {
601-
return '4.24.0';
601+
return '4.24.1';
602602
}
603603
}, {
604604
key: '_decideUUID',
@@ -1733,18 +1733,33 @@ return /******/ (function(modules) { // webpackBootstrap
17331733
}, {
17341734
key: '_startSubscribeLoop',
17351735
value: function _startSubscribeLoop() {
1736+
var _this6 = this;
1737+
17361738
this._stopSubscribeLoop();
1739+
var presenceState = {};
17371740
var channels = [];
17381741
var channelGroups = [];
17391742

17401743
Object.keys(this._channels).forEach(function (channel) {
1741-
return channels.push(channel);
1744+
var channelState = _this6._channels[channel].state;
1745+
1746+
if (Object.keys(channelState).length) {
1747+
presenceState[channel] = channelState;
1748+
}
1749+
1750+
channels.push(channel);
17421751
});
17431752
Object.keys(this._presenceChannels).forEach(function (channel) {
17441753
channels.push(channel + '-pnpres');
17451754
});
17461755

17471756
Object.keys(this._channelGroups).forEach(function (channelGroup) {
1757+
var channelGroupState = _this6._channelGroups[channelGroup].state;
1758+
1759+
if (Object.keys(channelGroupState).length) {
1760+
presenceState[channelGroup] = channelGroupState;
1761+
}
1762+
17481763
channelGroups.push(channelGroup);
17491764
});
17501765
Object.keys(this._presenceChannelGroups).forEach(function (channelGroup) {
@@ -1758,6 +1773,7 @@ return /******/ (function(modules) { // webpackBootstrap
17581773
var subscribeArgs = {
17591774
channels: channels,
17601775
channelGroups: channelGroups,
1776+
state: presenceState,
17611777
timetoken: this._currentTimetoken,
17621778
filterExpression: this._config.filterExpression,
17631779
region: this._region
@@ -1768,7 +1784,7 @@ return /******/ (function(modules) { // webpackBootstrap
17681784
}, {
17691785
key: '_processSubscribeResponse',
17701786
value: function _processSubscribeResponse(status, payload) {
1771-
var _this6 = this;
1787+
var _this7 = this;
17721788

17731789
if (status.error) {
17741790
if (status.category === _categories2.default.PNTimeoutCategory) {
@@ -1782,19 +1798,19 @@ return /******/ (function(modules) { // webpackBootstrap
17821798
}
17831799

17841800
this._reconnectionManager.onReconnection(function () {
1785-
if (_this6._config.autoNetworkDetection && !_this6._isOnline) {
1786-
_this6._isOnline = true;
1787-
_this6._listenerManager.announceNetworkUp();
1801+
if (_this7._config.autoNetworkDetection && !_this7._isOnline) {
1802+
_this7._isOnline = true;
1803+
_this7._listenerManager.announceNetworkUp();
17881804
}
1789-
_this6.reconnect();
1790-
_this6._subscriptionStatusAnnounced = true;
1805+
_this7.reconnect();
1806+
_this7._subscriptionStatusAnnounced = true;
17911807
var reconnectedAnnounce = {
17921808
category: _categories2.default.PNReconnectedCategory,
17931809
operation: status.operation,
1794-
lastTimetoken: _this6._lastTimetoken,
1795-
currentTimetoken: _this6._currentTimetoken
1810+
lastTimetoken: _this7._lastTimetoken,
1811+
currentTimetoken: _this7._currentTimetoken
17961812
};
1797-
_this6._listenerManager.announceStatus(reconnectedAnnounce);
1813+
_this7._listenerManager.announceStatus(reconnectedAnnounce);
17981814
});
17991815

18001816
this._reconnectionManager.startPolling();
@@ -1856,10 +1872,10 @@ return /******/ (function(modules) { // webpackBootstrap
18561872
}
18571873

18581874
if (dedupeOnSubscribe) {
1859-
if (_this6._dedupingManager.isDuplicate(message)) {
1875+
if (_this7._dedupingManager.isDuplicate(message)) {
18601876
return;
18611877
} else {
1862-
_this6._dedupingManager.addEntry(message);
1878+
_this7._dedupingManager.addEntry(message);
18631879
}
18641880
}
18651881

@@ -1899,7 +1915,7 @@ return /******/ (function(modules) { // webpackBootstrap
18991915
announce.timeout = message.payload.timeout;
19001916
}
19011917

1902-
_this6._listenerManager.announcePresence(announce);
1918+
_this7._listenerManager.announcePresence(announce);
19031919
} else {
19041920
var _announce = {};
19051921
_announce.channel = null;
@@ -1918,13 +1934,13 @@ return /******/ (function(modules) { // webpackBootstrap
19181934
_announce.userMetadata = message.userMetadata;
19191935
}
19201936

1921-
if (_this6._config.cipherKey) {
1922-
_announce.message = _this6._crypto.decrypt(message.payload);
1937+
if (_this7._config.cipherKey) {
1938+
_announce.message = _this7._crypto.decrypt(message.payload);
19231939
} else {
19241940
_announce.message = message.payload;
19251941
}
19261942

1927-
_this6._listenerManager.announceMessage(_announce);
1943+
_this7._listenerManager.announceMessage(_announce);
19281944
}
19291945
});
19301946

@@ -4525,7 +4541,8 @@ return /******/ (function(modules) { // webpackBootstrap
45254541

45264542
function prepareParams(_ref2, incomingParams) {
45274543
var config = _ref2.config;
4528-
var _incomingParams$chann2 = incomingParams.channelGroups,
4544+
var state = incomingParams.state,
4545+
_incomingParams$chann2 = incomingParams.channelGroups,
45294546
channelGroups = _incomingParams$chann2 === undefined ? [] : _incomingParams$chann2,
45304547
timetoken = incomingParams.timetoken,
45314548
filterExpression = incomingParams.filterExpression,
@@ -4543,6 +4560,10 @@ return /******/ (function(modules) { // webpackBootstrap
45434560
params['filter-expr'] = filterExpression;
45444561
}
45454562

4563+
if (Object.keys(state).length) {
4564+
params.state = JSON.stringify(state);
4565+
}
4566+
45464567
if (timetoken) {
45474568
params.tt = timetoken;
45484569
}

dist/titanium/pubnub.min.js

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

dist/web/pubnub.js

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! 4.24.0 / Consumer */
1+
/*! 4.24.1 / Consumer */
22
(function webpackUniversalModuleDefinition(root, factory) {
33
if(typeof exports === 'object' && typeof module === 'object')
44
module.exports = factory();
@@ -620,7 +620,7 @@ return /******/ (function(modules) { // webpackBootstrap
620620
}, {
621621
key: 'getVersion',
622622
value: function getVersion() {
623-
return '4.24.0';
623+
return '4.24.1';
624624
}
625625
}, {
626626
key: '_decideUUID',
@@ -1755,18 +1755,33 @@ return /******/ (function(modules) { // webpackBootstrap
17551755
}, {
17561756
key: '_startSubscribeLoop',
17571757
value: function _startSubscribeLoop() {
1758+
var _this6 = this;
1759+
17581760
this._stopSubscribeLoop();
1761+
var presenceState = {};
17591762
var channels = [];
17601763
var channelGroups = [];
17611764

17621765
Object.keys(this._channels).forEach(function (channel) {
1763-
return channels.push(channel);
1766+
var channelState = _this6._channels[channel].state;
1767+
1768+
if (Object.keys(channelState).length) {
1769+
presenceState[channel] = channelState;
1770+
}
1771+
1772+
channels.push(channel);
17641773
});
17651774
Object.keys(this._presenceChannels).forEach(function (channel) {
17661775
channels.push(channel + '-pnpres');
17671776
});
17681777

17691778
Object.keys(this._channelGroups).forEach(function (channelGroup) {
1779+
var channelGroupState = _this6._channelGroups[channelGroup].state;
1780+
1781+
if (Object.keys(channelGroupState).length) {
1782+
presenceState[channelGroup] = channelGroupState;
1783+
}
1784+
17701785
channelGroups.push(channelGroup);
17711786
});
17721787
Object.keys(this._presenceChannelGroups).forEach(function (channelGroup) {
@@ -1780,6 +1795,7 @@ return /******/ (function(modules) { // webpackBootstrap
17801795
var subscribeArgs = {
17811796
channels: channels,
17821797
channelGroups: channelGroups,
1798+
state: presenceState,
17831799
timetoken: this._currentTimetoken,
17841800
filterExpression: this._config.filterExpression,
17851801
region: this._region
@@ -1790,7 +1806,7 @@ return /******/ (function(modules) { // webpackBootstrap
17901806
}, {
17911807
key: '_processSubscribeResponse',
17921808
value: function _processSubscribeResponse(status, payload) {
1793-
var _this6 = this;
1809+
var _this7 = this;
17941810

17951811
if (status.error) {
17961812
if (status.category === _categories2.default.PNTimeoutCategory) {
@@ -1804,19 +1820,19 @@ return /******/ (function(modules) { // webpackBootstrap
18041820
}
18051821

18061822
this._reconnectionManager.onReconnection(function () {
1807-
if (_this6._config.autoNetworkDetection && !_this6._isOnline) {
1808-
_this6._isOnline = true;
1809-
_this6._listenerManager.announceNetworkUp();
1823+
if (_this7._config.autoNetworkDetection && !_this7._isOnline) {
1824+
_this7._isOnline = true;
1825+
_this7._listenerManager.announceNetworkUp();
18101826
}
1811-
_this6.reconnect();
1812-
_this6._subscriptionStatusAnnounced = true;
1827+
_this7.reconnect();
1828+
_this7._subscriptionStatusAnnounced = true;
18131829
var reconnectedAnnounce = {
18141830
category: _categories2.default.PNReconnectedCategory,
18151831
operation: status.operation,
1816-
lastTimetoken: _this6._lastTimetoken,
1817-
currentTimetoken: _this6._currentTimetoken
1832+
lastTimetoken: _this7._lastTimetoken,
1833+
currentTimetoken: _this7._currentTimetoken
18181834
};
1819-
_this6._listenerManager.announceStatus(reconnectedAnnounce);
1835+
_this7._listenerManager.announceStatus(reconnectedAnnounce);
18201836
});
18211837

18221838
this._reconnectionManager.startPolling();
@@ -1878,10 +1894,10 @@ return /******/ (function(modules) { // webpackBootstrap
18781894
}
18791895

18801896
if (dedupeOnSubscribe) {
1881-
if (_this6._dedupingManager.isDuplicate(message)) {
1897+
if (_this7._dedupingManager.isDuplicate(message)) {
18821898
return;
18831899
} else {
1884-
_this6._dedupingManager.addEntry(message);
1900+
_this7._dedupingManager.addEntry(message);
18851901
}
18861902
}
18871903

@@ -1921,7 +1937,7 @@ return /******/ (function(modules) { // webpackBootstrap
19211937
announce.timeout = message.payload.timeout;
19221938
}
19231939

1924-
_this6._listenerManager.announcePresence(announce);
1940+
_this7._listenerManager.announcePresence(announce);
19251941
} else {
19261942
var _announce = {};
19271943
_announce.channel = null;
@@ -1940,13 +1956,13 @@ return /******/ (function(modules) { // webpackBootstrap
19401956
_announce.userMetadata = message.userMetadata;
19411957
}
19421958

1943-
if (_this6._config.cipherKey) {
1944-
_announce.message = _this6._crypto.decrypt(message.payload);
1959+
if (_this7._config.cipherKey) {
1960+
_announce.message = _this7._crypto.decrypt(message.payload);
19451961
} else {
19461962
_announce.message = message.payload;
19471963
}
19481964

1949-
_this6._listenerManager.announceMessage(_announce);
1965+
_this7._listenerManager.announceMessage(_announce);
19501966
}
19511967
});
19521968

@@ -4547,7 +4563,8 @@ return /******/ (function(modules) { // webpackBootstrap
45474563

45484564
function prepareParams(_ref2, incomingParams) {
45494565
var config = _ref2.config;
4550-
var _incomingParams$chann2 = incomingParams.channelGroups,
4566+
var state = incomingParams.state,
4567+
_incomingParams$chann2 = incomingParams.channelGroups,
45514568
channelGroups = _incomingParams$chann2 === undefined ? [] : _incomingParams$chann2,
45524569
timetoken = incomingParams.timetoken,
45534570
filterExpression = incomingParams.filterExpression,
@@ -4565,6 +4582,10 @@ return /******/ (function(modules) { // webpackBootstrap
45654582
params['filter-expr'] = filterExpression;
45664583
}
45674584

4585+
if (Object.keys(state).length) {
4586+
params.state = JSON.stringify(state);
4587+
}
4588+
45684589
if (timetoken) {
45694590
params.tt = timetoken;
45704591
}

dist/web/pubnub.min.js

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

lib/core/components/config.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.

0 commit comments

Comments
 (0)