Socket
Socket
Sign inDemoInstall

pubnub

Package Overview
Dependencies
Maintainers
4
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pubnub - npm Package Compare versions

Comparing version 4.19.0 to 4.20.0

10

CHANGELOG.md

@@ -8,10 +8,10 @@

- 🌟add support for Native Script
- ⭐ add support for Native Script
- 🌟 add missing flow types
- ⭐add missing flow types
- 🌟 upgrade superagent to ^3.8.1
- ⭐upgrade superagent to ^3.8.1

@@ -27,6 +27,6 @@

- ⭐ keepAlive is now initialized globally instead of per-call, allowing better connection reuse
- ⭐keepAlive is now initialized globally instead of per-call, allowing better connection reuse
- 🌟added sdkName configuration parameter which allow completely override pnsdk in request query
- 🌟 added sdkName configuration parameter which allow completely override pnsdk in request query

@@ -33,0 +33,0 @@

@@ -1,1 +0,1 @@

{"errors":[],"warnings":[],"version":"1.15.0","hash":"a76118a3cf4ec56efbf3","publicPath":"","assetsByChunkName":{"main":"pubnub.js"},"assets":[{"name":"pubnub.js","size":153102,"chunks":[0],"chunkNames":["main"],"emitted":true},{"name":"stats.json","size":0,"chunks":[],"chunkNames":[]}],"chunks":[{"id":0,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":145596,"names":["main"],"files":["pubnub.js"],"hash":"6847a875920cb1fe30a2","parents":[],"modules":[],"filteredModules":43,"origins":[{"moduleId":0,"module":"/Users/max/Desktop/CLIENT/javascript/node_modules/babel-loader/lib/index.js!/Users/max/Desktop/CLIENT/javascript/src/titanium/index.js","moduleIdentifier":"/Users/max/Desktop/CLIENT/javascript/node_modules/babel-loader/lib/index.js!/Users/max/Desktop/CLIENT/javascript/src/titanium/index.js","moduleName":"./src/titanium/index.js","loc":"","name":"main","reasons":[]}]}],"modules":[],"filteredModules":43,"children":[]}
{"errors":[],"warnings":[],"version":"1.15.0","hash":"9b46fddb277521d6e03b","publicPath":"","assetsByChunkName":{"main":"pubnub.js"},"assets":[{"name":"pubnub.js","size":155849,"chunks":[0],"chunkNames":["main"],"emitted":true},{"name":"stats.json","size":0,"chunks":[],"chunkNames":[]}],"chunks":[{"id":0,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":148279,"names":["main"],"files":["pubnub.js"],"hash":"3350512e4f75a2638586","parents":[],"modules":[],"filteredModules":43,"origins":[{"moduleId":0,"module":"/Users/max/Desktop/CLIENT/javascript/node_modules/babel-loader/lib/index.js!/Users/max/Desktop/CLIENT/javascript/src/titanium/index.js","moduleIdentifier":"/Users/max/Desktop/CLIENT/javascript/node_modules/babel-loader/lib/index.js!/Users/max/Desktop/CLIENT/javascript/src/titanium/index.js","moduleName":"./src/titanium/index.js","loc":"","name":"main","reasons":[]}]}],"modules":[],"filteredModules":43,"children":[]}

@@ -1,1 +0,1 @@

{"errors":[],"warnings":[],"version":"1.15.0","hash":"89b29e0e8f902a09a808","publicPath":"","assetsByChunkName":{"main":"pubnub.js"},"assets":[{"name":"pubnub.js","size":187409,"chunks":[0],"chunkNames":["main"],"emitted":true},{"name":"stats.json","size":0,"chunks":[],"chunkNames":[]}],"chunks":[{"id":0,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":178292,"names":["main"],"files":["pubnub.js"],"hash":"9d18ed70c174e36f9548","parents":[],"modules":[],"filteredModules":47,"origins":[{"moduleId":0,"module":"/Users/max/Desktop/CLIENT/javascript/node_modules/babel-loader/lib/index.js!/Users/max/Desktop/CLIENT/javascript/src/web/index.js","moduleIdentifier":"/Users/max/Desktop/CLIENT/javascript/node_modules/babel-loader/lib/index.js!/Users/max/Desktop/CLIENT/javascript/src/web/index.js","moduleName":"./src/web/index.js","loc":"","name":"main","reasons":[]}]}],"modules":[],"filteredModules":47,"children":[]}
{"errors":[],"warnings":[],"version":"1.15.0","hash":"0090b091bc2efa41b4e7","publicPath":"","assetsByChunkName":{"main":"pubnub.js"},"assets":[{"name":"pubnub.js","size":190156,"chunks":[0],"chunkNames":["main"],"emitted":true},{"name":"stats.json","size":0,"chunks":[],"chunkNames":[]}],"chunks":[{"id":0,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":180975,"names":["main"],"files":["pubnub.js"],"hash":"d3959753cb619cb6b041","parents":[],"modules":[],"filteredModules":47,"origins":[{"moduleId":0,"module":"/Users/max/Desktop/CLIENT/javascript/node_modules/babel-loader/lib/index.js!/Users/max/Desktop/CLIENT/javascript/src/web/index.js","moduleIdentifier":"/Users/max/Desktop/CLIENT/javascript/node_modules/babel-loader/lib/index.js!/Users/max/Desktop/CLIENT/javascript/src/web/index.js","moduleName":"./src/web/index.js","loc":"","name":"main","reasons":[]}]}],"modules":[],"filteredModules":47,"children":[]}

@@ -134,2 +134,7 @@ 'use strict';

}, {
key: 'setProxy',
value: function setProxy(proxy) {
this.proxy = proxy;
}
}, {
key: 'getHeartbeatInterval',

@@ -177,3 +182,3 @@ value: function getHeartbeatInterval() {

value: function getVersion() {
return '4.19.0';
return '4.20.0';
}

@@ -180,0 +185,0 @@ }, {

@@ -69,2 +69,5 @@ 'use strict';

this._heartbeatChannels = {};
this._heartbeatChannelGroups = {};
this._channelGroups = {};

@@ -111,11 +114,53 @@ this._presenceChannelGroups = {};

}, {
key: 'adaptSubscribeChange',
value: function adaptSubscribeChange(args) {
key: 'adaptPresenceChange',
value: function adaptPresenceChange(args) {
var _this2 = this;
var timetoken = args.timetoken,
var connected = args.connected,
_args$channels2 = args.channels,
channels = _args$channels2 === undefined ? [] : _args$channels2,
_args$channelGroups2 = args.channelGroups,
channelGroups = _args$channelGroups2 === undefined ? [] : _args$channelGroups2,
channelGroups = _args$channelGroups2 === undefined ? [] : _args$channelGroups2;
if (connected) {
channels.forEach(function (channel) {
_this2._heartbeatChannels[channel] = { state: {} };
});
channelGroups.forEach(function (channelGroup) {
_this2._heartbeatChannelGroups[channelGroup] = { state: {} };
});
} else {
channels.forEach(function (channel) {
if (channel in _this2._heartbeatChannels) {
delete _this2._heartbeatChannels[channel];
}
});
channelGroups.forEach(function (channelGroup) {
if (channelGroup in _this2._heartbeatChannelGroups) {
delete _this2._heartbeatChannelGroups[channelGroup];
}
});
if (this._config.suppressLeaveEvents === false) {
this._leaveEndpoint({ channels: channels, channelGroups: channelGroups }, function (status) {
_this2._listenerManager.announceStatus(status);
});
}
}
this.reconnect();
}
}, {
key: 'adaptSubscribeChange',
value: function adaptSubscribeChange(args) {
var _this3 = this;
var timetoken = args.timetoken,
_args$channels3 = args.channels,
channels = _args$channels3 === undefined ? [] : _args$channels3,
_args$channelGroups3 = args.channelGroups,
channelGroups = _args$channelGroups3 === undefined ? [] : _args$channelGroups3,
_args$withPresence = args.withPresence,

@@ -141,13 +186,13 @@ withPresence = _args$withPresence === undefined ? false : _args$withPresence;

channels.forEach(function (channel) {
_this2._channels[channel] = { state: {} };
if (withPresence) _this2._presenceChannels[channel] = {};
_this3._channels[channel] = { state: {} };
if (withPresence) _this3._presenceChannels[channel] = {};
_this2._pendingChannelSubscriptions.push(channel);
_this3._pendingChannelSubscriptions.push(channel);
});
channelGroups.forEach(function (channelGroup) {
_this2._channelGroups[channelGroup] = { state: {} };
if (withPresence) _this2._presenceChannelGroups[channelGroup] = {};
_this3._channelGroups[channelGroup] = { state: {} };
if (withPresence) _this3._presenceChannelGroups[channelGroup] = {};
_this2._pendingChannelGroupSubscriptions.push(channelGroup);
_this3._pendingChannelGroupSubscriptions.push(channelGroup);
});

@@ -161,8 +206,8 @@

value: function adaptUnsubscribeChange(args, isOffline) {
var _this3 = this;
var _this4 = this;
var _args$channels3 = args.channels,
channels = _args$channels3 === undefined ? [] : _args$channels3,
_args$channelGroups3 = args.channelGroups,
channelGroups = _args$channelGroups3 === undefined ? [] : _args$channelGroups3;
var _args$channels4 = args.channels,
channels = _args$channels4 === undefined ? [] : _args$channels4,
_args$channelGroups4 = args.channelGroups,
channelGroups = _args$channelGroups4 === undefined ? [] : _args$channelGroups4;

@@ -174,8 +219,8 @@ var actualChannels = [];

channels.forEach(function (channel) {
if (channel in _this3._channels) {
delete _this3._channels[channel];
if (channel in _this4._channels) {
delete _this4._channels[channel];
actualChannels.push(channel);
}
if (channel in _this3._presenceChannels) {
delete _this3._presenceChannels[channel];
if (channel in _this4._presenceChannels) {
delete _this4._presenceChannels[channel];
actualChannels.push(channel);

@@ -186,8 +231,8 @@ }

channelGroups.forEach(function (channelGroup) {
if (channelGroup in _this3._channelGroups) {
delete _this3._channelGroups[channelGroup];
if (channelGroup in _this4._channelGroups) {
delete _this4._channelGroups[channelGroup];
actualChannelGroups.push(channelGroup);
}
if (channelGroup in _this3._presenceChannelGroups) {
delete _this3._channelGroups[channelGroup];
if (channelGroup in _this4._presenceChannelGroups) {
delete _this4._channelGroups[channelGroup];
actualChannelGroups.push(channelGroup);

@@ -205,5 +250,5 @@ }

status.affectedChannelGroups = actualChannelGroups;
status.currentTimetoken = _this3._currentTimetoken;
status.lastTimetoken = _this3._lastTimetoken;
_this3._listenerManager.announceStatus(status);
status.currentTimetoken = _this4._currentTimetoken;
status.lastTimetoken = _this4._lastTimetoken;
_this4._listenerManager.announceStatus(status);
});

@@ -228,2 +273,12 @@ }

}, {
key: 'getHeartbeatChannels',
value: function getHeartbeatChannels() {
return Object.keys(this._heartbeatChannels);
}
}, {
key: 'getHeartbeatChannelGroups',
value: function getHeartbeatChannelGroups() {
return Object.keys(this._heartbeatChannelGroups);
}
}, {
key: 'getSubscribedChannels',

@@ -274,19 +329,25 @@ value: function getSubscribedChannels() {

value: function _performHeartbeatLoop() {
var _this4 = this;
var _this5 = this;
var presenceChannels = Object.keys(this._channels);
var presenceChannelGroups = Object.keys(this._channelGroups);
var heartbeatChannels = [];
heartbeatChannels = heartbeatChannels.concat(this.getHeartbeatChannels());
heartbeatChannels = heartbeatChannels.concat(this.getSubscribedChannels());
var heartbeatChannelGroups = [];
heartbeatChannelGroups = heartbeatChannelGroups.concat(this.getHeartbeatChannelGroups());
heartbeatChannelGroups = heartbeatChannelGroups.concat(this.getSubscribedChannelGroups());
var presenceState = {};
if (presenceChannels.length === 0 && presenceChannelGroups.length === 0) {
if (heartbeatChannels.length === 0 && heartbeatChannelGroups.length === 0) {
return;
}
presenceChannels.forEach(function (channel) {
var channelState = _this4._channels[channel].state;
this.getSubscribedChannels().forEach(function (channel) {
var channelState = _this5._channels[channel].state;
if (Object.keys(channelState).length) presenceState[channel] = channelState;
});
presenceChannelGroups.forEach(function (channelGroup) {
var channelGroupState = _this4._channelGroups[channelGroup].state;
this.getSubscribedChannelGroups().forEach(function (channelGroup) {
var channelGroupState = _this5._channelGroups[channelGroup].state;
if (Object.keys(channelGroupState).length) presenceState[channelGroup] = channelGroupState;

@@ -296,15 +357,15 @@ });

var onHeartbeat = function onHeartbeat(status) {
if (status.error && _this4._config.announceFailedHeartbeats) {
_this4._listenerManager.announceStatus(status);
if (status.error && _this5._config.announceFailedHeartbeats) {
_this5._listenerManager.announceStatus(status);
}
if (status.error && _this4._config.autoNetworkDetection && _this4._isOnline) {
_this4._isOnline = false;
_this4.disconnect();
_this4._listenerManager.announceNetworkDown();
_this4.reconnect();
if (status.error && _this5._config.autoNetworkDetection && _this5._isOnline) {
_this5._isOnline = false;
_this5.disconnect();
_this5._listenerManager.announceNetworkDown();
_this5.reconnect();
}
if (!status.error && _this4._config.announceSuccessfulHeartbeats) {
_this4._listenerManager.announceStatus(status);
if (!status.error && _this5._config.announceSuccessfulHeartbeats) {
_this5._listenerManager.announceStatus(status);
}

@@ -314,4 +375,4 @@ };

this._heartbeatEndpoint({
channels: presenceChannels,
channelGroups: presenceChannelGroups,
channels: heartbeatChannels,
channelGroups: heartbeatChannelGroups,
state: presenceState }, onHeartbeat.bind(this));

@@ -357,3 +418,3 @@ }

value: function _processSubscribeResponse(status, payload) {
var _this5 = this;
var _this6 = this;

@@ -372,15 +433,15 @@ if (status.error) {

this._reconnectionManager.onReconnection(function () {
if (_this5._config.autoNetworkDetection && !_this5._isOnline) {
_this5._isOnline = true;
_this5._listenerManager.announceNetworkUp();
if (_this6._config.autoNetworkDetection && !_this6._isOnline) {
_this6._isOnline = true;
_this6._listenerManager.announceNetworkUp();
}
_this5.reconnect();
_this5._subscriptionStatusAnnounced = true;
_this6.reconnect();
_this6._subscriptionStatusAnnounced = true;
var reconnectedAnnounce = {
category: _categories2.default.PNReconnectedCategory,
operation: status.operation,
lastTimetoken: _this5._lastTimetoken,
currentTimetoken: _this5._currentTimetoken
lastTimetoken: _this6._lastTimetoken,
currentTimetoken: _this6._currentTimetoken
};
_this5._listenerManager.announceStatus(reconnectedAnnounce);
_this6._listenerManager.announceStatus(reconnectedAnnounce);
});

@@ -447,6 +508,6 @@

if (dedupeOnSubscribe) {
if (_this5._dedupingManager.isDuplicate(message)) {
if (_this6._dedupingManager.isDuplicate(message)) {
return;
} else {
_this5._dedupingManager.addEntry(message);
_this6._dedupingManager.addEntry(message);
}

@@ -491,3 +552,3 @@ }

_this5._listenerManager.announcePresence(announce);
_this6._listenerManager.announcePresence(announce);
} else {

@@ -511,4 +572,4 @@ var _announce = {};

if (_this5._config.cipherKey) {
_announce.message = _this5._crypto.decrypt(message.payload);
if (_this6._config.cipherKey) {
_announce.message = _this6._crypto.decrypt(message.payload);
} else {

@@ -518,3 +579,3 @@ _announce.message = message.payload;

_this5._listenerManager.announceMessage(_announce);
_this6._listenerManager.announceMessage(_announce);
}

@@ -521,0 +582,0 @@ });

@@ -219,2 +219,3 @@ 'use strict';

this.subscribe = subscriptionManager.adaptSubscribeChange.bind(subscriptionManager);
this.presence = subscriptionManager.adaptPresenceChange.bind(subscriptionManager);
this.unsubscribe = subscriptionManager.adaptUnsubscribeChange.bind(subscriptionManager);

@@ -248,2 +249,9 @@ this.disconnect = subscriptionManager.disconnect.bind(subscriptionManager);

this.setHeartbeatInterval = modules.config.setHeartbeatInterval.bind(modules.config);
if (networking.hasModule('proxy')) {
this.setProxy = function (proxy) {
modules.config.setProxy(proxy);
_this.reconnect();
};
}
}

@@ -250,0 +258,0 @@

@@ -68,2 +68,7 @@ 'use strict';

}, {
key: 'hasModule',
value: function hasModule(name) {
return name in this._modules;
}
}, {
key: 'shiftStandardOrigin',

@@ -70,0 +75,0 @@ value: function shiftStandardOrigin() {

@@ -42,2 +42,3 @@ 'use strict';

setup.sdkFamily = 'Nodejs';
setup.ssl = true;

@@ -44,0 +45,0 @@ return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).call(this, setup));

{
"name": "pubnub",
"version": "4.19.0",
"version": "4.20.0",
"author": "PubNub <support@pubnub.com>",

@@ -5,0 +5,0 @@ "description": "Publish & Subscribe Real-time Messaging with PubNub",

@@ -22,3 +22,3 @@ # PubNub JavaScript SDK (V4)

## CDN Links
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.19.0.min.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.19.0.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.20.0.min.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.20.0.js

@@ -5,3 +5,3 @@ /* @flow */

import uuidGenerator from './uuid';
import { InternalSetupStruct, DatabaseInterface, KeepAliveStruct } from '../flow_interfaces';
import { InternalSetupStruct, DatabaseInterface, KeepAliveStruct, ProxyStruct } from '../flow_interfaces';

@@ -24,3 +24,3 @@ type ConfigConstructArgs = {

proxy: string;
proxy: ProxyStruct;

@@ -215,2 +215,6 @@ /*

setProxy(proxy: ProxyStruct) {
this.proxy = proxy;
}
getHeartbeatInterval(): number { return this._heartbeatInterval; }

@@ -230,3 +234,3 @@ setHeartbeatInterval(val: number): this { this._heartbeatInterval = val; return this; }

getVersion(): string {
return '4.19.0';
return '4.20.0';
}

@@ -233,0 +237,0 @@

@@ -18,2 +18,8 @@ /* @flow */

type PresenceArgs = {
channels: Array<string>,
channelGroups: Array<string>,
connected: boolean
}
type UnsubscribeArgs = {

@@ -56,2 +62,5 @@ channels: Array<string>,

_heartbeatChannels: Object;
_heartbeatChannelGroups: Object;
_channelGroups: Object;

@@ -95,2 +104,5 @@ _presenceChannelGroups: Object;

this._heartbeatChannels = {};
this._heartbeatChannelGroups = {};
this._channelGroups = {};

@@ -128,2 +140,36 @@ this._presenceChannelGroups = {};

adaptPresenceChange(args: PresenceArgs) {
const { connected, channels = [], channelGroups = [] } = args;
if (connected) {
channels.forEach((channel: string) => {
this._heartbeatChannels[channel] = { state: {} };
});
channelGroups.forEach((channelGroup: string) => {
this._heartbeatChannelGroups[channelGroup] = { state: {} };
});
} else {
channels.forEach((channel) => {
if (channel in this._heartbeatChannels) {
delete this._heartbeatChannels[channel];
}
});
channelGroups.forEach((channelGroup) => {
if (channelGroup in this._heartbeatChannelGroups) {
delete this._heartbeatChannelGroups[channelGroup];
}
});
if (this._config.suppressLeaveEvents === false) {
this._leaveEndpoint({ channels, channelGroups }, (status) => {
this._listenerManager.announceStatus(status);
});
}
}
this.reconnect();
}
adaptSubscribeChange(args: SubscribeArgs) {

@@ -231,2 +277,10 @@ const { timetoken, channels = [], channelGroups = [], withPresence = false } = args;

getHeartbeatChannels(): Array<string> {
return Object.keys(this._heartbeatChannels);
}
getHeartbeatChannelGroups(): Array<string> {
return Object.keys(this._heartbeatChannelGroups);
}
getSubscribedChannels(): Array<string> {

@@ -271,11 +325,17 @@ return Object.keys(this._channels);

_performHeartbeatLoop() {
let presenceChannels = Object.keys(this._channels);
let presenceChannelGroups = Object.keys(this._channelGroups);
let heartbeatChannels = [];
heartbeatChannels = heartbeatChannels.concat(this.getHeartbeatChannels());
heartbeatChannels = heartbeatChannels.concat(this.getSubscribedChannels());
let heartbeatChannelGroups = [];
heartbeatChannelGroups = heartbeatChannelGroups.concat(this.getHeartbeatChannelGroups());
heartbeatChannelGroups = heartbeatChannelGroups.concat(this.getSubscribedChannelGroups());
let presenceState = {};
if (presenceChannels.length === 0 && presenceChannelGroups.length === 0) {
if (heartbeatChannels.length === 0 && heartbeatChannelGroups.length === 0) {
return;
}
presenceChannels.forEach((channel) => {
this.getSubscribedChannels().forEach((channel) => {
let channelState = this._channels[channel].state;

@@ -285,3 +345,3 @@ if (Object.keys(channelState).length) presenceState[channel] = channelState;

presenceChannelGroups.forEach((channelGroup) => {
this.getSubscribedChannelGroups().forEach((channelGroup) => {
let channelGroupState = this._channelGroups[channelGroup].state;

@@ -309,4 +369,4 @@ if (Object.keys(channelGroupState).length) presenceState[channelGroup] = channelGroupState;

this._heartbeatEndpoint({
channels: presenceChannels,
channelGroups: presenceChannelGroups,
channels: heartbeatChannels,
channelGroups: heartbeatChannelGroups,
state: presenceState }, onHeartbeat.bind(this));

@@ -313,0 +373,0 @@ }

@@ -72,2 +72,3 @@ /* @flow */

subscribe: Function;
presence: Function;
unsubscribe: Function;

@@ -102,2 +103,4 @@ unsubscribeAll: Function;

setProxy: Function;
encrypt: Function;

@@ -182,2 +185,3 @@ decrypt: Function;

this.subscribe = subscriptionManager.adaptSubscribeChange.bind(subscriptionManager);
this.presence = subscriptionManager.adaptPresenceChange.bind(subscriptionManager);
this.unsubscribe = subscriptionManager.adaptUnsubscribeChange.bind(subscriptionManager);

@@ -215,2 +219,9 @@ this.disconnect = subscriptionManager.disconnect.bind(subscriptionManager);

this.setHeartbeatInterval = modules.config.setHeartbeatInterval.bind(modules.config);
if (networking.hasModule('proxy')) {
this.setProxy = (proxy) => {
modules.config.setProxy(proxy);
this.reconnect();
};
}
}

@@ -217,0 +228,0 @@

@@ -63,2 +63,6 @@ /* @flow */

hasModule(name: string) {
return name in this._modules;
}
// origin operations

@@ -65,0 +69,0 @@ shiftStandardOrigin(failover: boolean = false): string {

@@ -15,2 +15,3 @@ /* @flow */

setup.sdkFamily = 'Nodejs';
setup.ssl = true;

@@ -17,0 +18,0 @@ super(setup);

@@ -225,2 +225,46 @@ /* global describe, beforeEach, it, before, afterEach, after */

it('reports when heartbeats pass with heartbeatChannels', (done) => {
const scope = utils.createNock().get('/v2/presence/sub-key/mySubKey/channel/ch1%2Cch2/heartbeat')
.query({ pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`, uuid: 'myUUID', heartbeat: 300, state: '{}' })
.reply(200, '{"status": 200, "message": "OK", "service": "Presence"}');
pubnubWithPassingHeartbeats.addListener({
status(statusPayload) {
if (statusPayload.operation !== PubNub.OPERATIONS.PNHeartbeatOperation) return;
assert.equal(scope.isDone(), true);
assert.deepEqual({
error: false,
operation: 'PNHeartbeatOperation',
statusCode: 200
}, statusPayload);
done();
}
});
pubnubWithPassingHeartbeats.presence({ channels: ['ch1', 'ch2'], connected: true });
});
it('reports when heartbeats pass with heartbeatChannelGroups', (done) => {
const scope = utils.createNock().get('/v2/presence/sub-key/mySubKey/channel/%2C/heartbeat')
.query({ pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`, uuid: 'myUUID', heartbeat: 300, state: '{}', 'channel-group': 'cg1' })
.reply(200, '{"status": 200, "message": "OK", "service": "Presence"}');
pubnubWithPassingHeartbeats.addListener({
status(statusPayload) {
if (statusPayload.operation !== PubNub.OPERATIONS.PNHeartbeatOperation) return;
assert.equal(scope.isDone(), true);
assert.deepEqual({
error: false,
operation: 'PNHeartbeatOperation',
statusCode: 200
}, statusPayload);
done();
}
});
pubnubWithPassingHeartbeats.presence({ channelGroups: ['cg1'], connected: true });
});
it('reports when the queue is beyond set threshold', (done) => {

@@ -227,0 +271,0 @@ const scope = utils.createNock().get('/v2/subscribe/mySubKey/ch1%2Cch2%2Cch1-pnpres%2Cch2-pnpres/0')

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc