Comparing version 7.2.2 to 7.2.3
@@ -0,1 +1,7 @@ | ||
## v7.2.3 | ||
June 19 2023 | ||
#### Added | ||
- Added optional param `withHeartbeat` to set state through heartbeat endpoint. | ||
## v7.2.2 | ||
@@ -2,0 +8,0 @@ December 12 2022 |
@@ -172,3 +172,3 @@ "use strict"; | ||
default_1.prototype.getVersion = function () { | ||
return '7.2.2'; | ||
return '7.2.3'; | ||
}; | ||
@@ -175,0 +175,0 @@ default_1.prototype._addPnsdkSuffix = function (name, suffix) { |
@@ -61,3 +61,3 @@ "use strict"; | ||
var _this = this; | ||
var state = args.state, _a = args.channels, channels = _a === void 0 ? [] : _a, _b = args.channelGroups, channelGroups = _b === void 0 ? [] : _b; | ||
var state = args.state, _a = args.channels, channels = _a === void 0 ? [] : _a, _b = args.channelGroups, channelGroups = _b === void 0 ? [] : _b, _c = args.withHeartbeat, withHeartbeat = _c === void 0 ? false : _c; | ||
channels.forEach(function (channel) { | ||
@@ -72,2 +72,8 @@ if (channel in _this._channels) | ||
}); | ||
if (withHeartbeat) { | ||
var presenceState_1 = {}; | ||
channels.forEach(function (channel) { return (presenceState_1[channel] = state); }); | ||
channelGroups.forEach(function (group) { return (presenceState_1[group] = state); }); | ||
return this._heartbeatEndpoint({ channels: channels, channelGroups: channelGroups, state: presenceState_1 }, callback); | ||
} | ||
return this._setStateEndpoint({ state: state, channels: channels, channelGroups: channelGroups }, callback); | ||
@@ -74,0 +80,0 @@ }; |
"use strict"; | ||
/* */ | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -4,0 +3,0 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; |
{ | ||
"name": "pubnub", | ||
"version": "7.2.2", | ||
"version": "7.2.3", | ||
"author": "PubNub <support@pubnub.com>", | ||
@@ -5,0 +5,0 @@ "description": "Publish & Subscribe Real-time Messaging with PubNub", |
@@ -25,4 +25,4 @@ # PubNub JavaScript SDK (V4) | ||
* or download one of our builds from our CDN: | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.7.2.2.js | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.7.2.2.min.js | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.7.2.3.js | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.7.2.3.min.js | ||
@@ -29,0 +29,0 @@ 2. Configure your keys: |
@@ -342,3 +342,3 @@ /* */ | ||
getVersion() { | ||
return '7.2.2'; | ||
return '7.2.3'; | ||
} | ||
@@ -345,0 +345,0 @@ |
@@ -110,3 +110,3 @@ import ReconnectionManager from './reconnection_manager'; | ||
adaptStateChange(args, callback) { | ||
const { state, channels = [], channelGroups = [] } = args; | ||
const { state, channels = [], channelGroups = [], withHeartbeat = false } = args; | ||
@@ -123,2 +123,12 @@ channels.forEach((channel) => { | ||
if (withHeartbeat) { | ||
let presenceState = {}; | ||
channels.forEach((channel) => (presenceState[channel] = state)); | ||
channelGroups.forEach((group) => (presenceState[group] = state)); | ||
return this._heartbeatEndpoint( | ||
{ channels: channels, channelGroups: channelGroups, state: presenceState }, | ||
callback, | ||
); | ||
} | ||
return this._setStateEndpoint({ state, channels, channelGroups }, callback); | ||
@@ -125,0 +135,0 @@ } |
@@ -1,4 +0,1 @@ | ||
/* */ | ||
import { SetStateArguments, SetStateResponse, ModulesInject } from '../../flow_interfaces'; | ||
import operationConstants from '../../constants/operations'; | ||
@@ -5,0 +2,0 @@ import utils from '../../utils'; |
@@ -38,6 +38,3 @@ /* global describe, beforeEach, it, before, after */ | ||
}) | ||
.reply( | ||
200, | ||
'{"status": 200, "message": "OK", "payload": {"channels": ["a","b"]}, "service": "Presence"}' | ||
); | ||
.reply(200, '{"status": 200, "message": "OK", "payload": {"channels": ["a","b"]}, "service": "Presence"}'); | ||
@@ -60,6 +57,3 @@ pubnub.whereNow({}, (status, response) => { | ||
}) | ||
.reply( | ||
200, | ||
'{"status": 200, "message": "OK", "payload": {"channels": ["a","b"]}, "service": "Presence"}' | ||
); | ||
.reply(200, '{"status": 200, "message": "OK", "payload": {"channels": ["a","b"]}, "service": "Presence"}'); | ||
@@ -88,6 +82,3 @@ const pubnubClient = new PubNub({ | ||
}) | ||
.reply( | ||
200, | ||
'{"status": 200, "message": "OK", "payload": {"channels": ["a","b"]}, "service": "Presence"}' | ||
); | ||
.reply(200, '{"status": 200, "message": "OK", "payload": {"channels": ["a","b"]}, "service": "Presence"}'); | ||
@@ -127,12 +118,14 @@ pubnub.whereNow({ uuid: 'otherUUID' }, (status, response) => { | ||
utils.runAPIWithResponseDelays(scope, | ||
200, | ||
'{"status": 200, "message": "OK", "payload": {"channels": ["a","b"]}, "service": "Presence"}', | ||
delays, | ||
(completion) => { | ||
pubnub.whereNow( | ||
{}, | ||
() => { completion(); } | ||
); | ||
}) | ||
utils | ||
.runAPIWithResponseDelays( | ||
scope, | ||
200, | ||
'{"status": 200, "message": "OK", "payload": {"channels": ["a","b"]}, "service": "Presence"}', | ||
delays, | ||
(completion) => { | ||
pubnub.whereNow({}, () => { | ||
completion(); | ||
}); | ||
}, | ||
) | ||
.then((lastRequest) => { | ||
@@ -149,5 +142,3 @@ utils.verifyRequestTelemetry(lastRequest.path, 'l_pres', average, leeway); | ||
.createNock() | ||
.get( | ||
'/v2/presence/sub-key/mySubscribeKey/channel/testChannel/uuid/myUUID/data' | ||
) | ||
.get('/v2/presence/sub-key/mySubscribeKey/channel/testChannel/uuid/myUUID/data') | ||
.query({ | ||
@@ -160,14 +151,11 @@ pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`, | ||
200, | ||
'{ "status": 200, "message": "OK", "payload": { "age" : 20, "status" : "online"}, "service": "Presence"}' | ||
'{ "status": 200, "message": "OK", "payload": { "age" : 20, "status" : "online"}, "service": "Presence"}', | ||
); | ||
pubnub.setState( | ||
{ channels: ['testChannel'], state: { new: 'state' } }, | ||
(status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.state, { age: 20, status: 'online' }); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
} | ||
); | ||
pubnub.setState({ channels: ['testChannel'], state: { new: 'state' } }, (status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.state, { age: 20, status: 'online' }); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
}); | ||
}); | ||
@@ -178,5 +166,3 @@ | ||
.createNock() | ||
.get( | ||
'/v2/presence/sub-key/mySubscribeKey/channel/testChannel%231/uuid/myUUID%231/data' | ||
) | ||
.get('/v2/presence/sub-key/mySubscribeKey/channel/testChannel%231/uuid/myUUID%231/data') | ||
.query({ | ||
@@ -189,3 +175,3 @@ pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`, | ||
200, | ||
'{ "status": 200, "message": "OK", "payload": { "age" : 20, "status" : "online"}, "service": "Presence"}' | ||
'{ "status": 200, "message": "OK", "payload": { "age" : 20, "status" : "online"}, "service": "Presence"}', | ||
); | ||
@@ -199,11 +185,8 @@ | ||
pubnubClient.setState( | ||
{ channels: ['testChannel#1'], state: { new: 'state' } }, | ||
(status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.state, { age: 20, status: 'online' }); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
} | ||
); | ||
pubnubClient.setState({ channels: ['testChannel#1'], state: { new: 'state' } }, (status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.state, { age: 20, status: 'online' }); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
}); | ||
}); | ||
@@ -214,5 +197,3 @@ | ||
.createNock() | ||
.get( | ||
'/v2/presence/sub-key/mySubscribeKey/channel/ch1%2Cch2/uuid/myUUID/data' | ||
) | ||
.get('/v2/presence/sub-key/mySubscribeKey/channel/ch1%2Cch2/uuid/myUUID/data') | ||
.query({ | ||
@@ -225,17 +206,14 @@ pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`, | ||
200, | ||
'{ "status": 200, "message": "OK", "payload": { "ch1": { "age" : 20, "status" : "online"}, "ch2": { "age": 100, "status": "offline" } }, "service": "Presence"}' | ||
'{ "status": 200, "message": "OK", "payload": { "ch1": { "age" : 20, "status" : "online"}, "ch2": { "age": 100, "status": "offline" } }, "service": "Presence"}', | ||
); | ||
pubnub.setState( | ||
{ channels: ['ch1', 'ch2'], state: { new: 'state' } }, | ||
(status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.state, { | ||
ch1: { age: 20, status: 'online' }, | ||
ch2: { age: 100, status: 'offline' }, | ||
}); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
} | ||
); | ||
pubnub.setState({ channels: ['ch1', 'ch2'], state: { new: 'state' } }, (status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.state, { | ||
ch1: { age: 20, status: 'online' }, | ||
ch2: { age: 100, status: 'offline' }, | ||
}); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
}); | ||
}); | ||
@@ -246,5 +224,3 @@ | ||
.createNock() | ||
.get( | ||
'/v2/presence/sub-key/mySubscribeKey/channel/ch1%2Cch2/uuid/myUUID/data' | ||
) | ||
.get('/v2/presence/sub-key/mySubscribeKey/channel/ch1%2Cch2/uuid/myUUID/data') | ||
.query({ | ||
@@ -258,3 +234,3 @@ pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`, | ||
200, | ||
'{ "status": 200, "message": "OK", "payload": { "age" : 20, "status" : "online"}, "service": "Presence"}' | ||
'{ "status": 200, "message": "OK", "payload": { "age" : 20, "status" : "online"}, "service": "Presence"}', | ||
); | ||
@@ -273,3 +249,3 @@ | ||
done(); | ||
} | ||
}, | ||
); | ||
@@ -279,3 +255,6 @@ }); | ||
it('should add set state API telemetry information', (done) => { | ||
let scope = utils.createNock().get('/v2/presence/sub-key/mySubscribeKey/channel/testChannel/uuid/myUUID/data').query(true); | ||
let scope = utils | ||
.createNock() | ||
.get('/v2/presence/sub-key/mySubscribeKey/channel/testChannel/uuid/myUUID/data') | ||
.query(true); | ||
const delays = [100, 200, 300, 400]; | ||
@@ -286,12 +265,14 @@ const countedDelays = delays.slice(0, delays.length - 1); | ||
utils.runAPIWithResponseDelays(scope, | ||
200, | ||
'{ "status": 200, "message": "OK", "payload": { "age" : 20, "status" : "online"}, "service": "Presence"}', | ||
delays, | ||
(completion) => { | ||
pubnub.setState( | ||
{ channels: ['testChannel'], state: { new: 'state' } }, | ||
() => { completion(); } | ||
); | ||
}) | ||
utils | ||
.runAPIWithResponseDelays( | ||
scope, | ||
200, | ||
'{ "status": 200, "message": "OK", "payload": { "age" : 20, "status" : "online"}, "service": "Presence"}', | ||
delays, | ||
(completion) => { | ||
pubnub.setState({ channels: ['testChannel'], state: { new: 'state' } }, () => { | ||
completion(); | ||
}); | ||
}, | ||
) | ||
.then((lastRequest) => { | ||
@@ -308,5 +289,3 @@ utils.verifyRequestTelemetry(lastRequest.path, 'l_pres', average, leeway); | ||
.createNock() | ||
.get( | ||
'/v2/presence/sub-key/mySubscribeKey/channel/testChannel/uuid/myUUID' | ||
) | ||
.get('/v2/presence/sub-key/mySubscribeKey/channel/testChannel/uuid/myUUID') | ||
.query({ | ||
@@ -318,3 +297,3 @@ pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`, | ||
200, | ||
'{ "status": 200, "message": "OK", "payload": { "age" : 20, "status" : "online"}, "service": "Presence"}' | ||
'{ "status": 200, "message": "OK", "payload": { "age" : 20, "status" : "online"}, "service": "Presence"}', | ||
); | ||
@@ -335,5 +314,3 @@ | ||
.createNock() | ||
.get( | ||
'/v2/presence/sub-key/mySubscribeKey/channel/testChannel/uuid/otherUUID' | ||
) | ||
.get('/v2/presence/sub-key/mySubscribeKey/channel/testChannel/uuid/otherUUID') | ||
.query({ | ||
@@ -345,16 +322,13 @@ pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`, | ||
200, | ||
'{ "status": 200, "message": "OK", "payload": { "age" : 20, "status" : "online"}, "service": "Presence"}' | ||
'{ "status": 200, "message": "OK", "payload": { "age" : 20, "status" : "online"}, "service": "Presence"}', | ||
); | ||
pubnub.getState( | ||
{ uuid: 'otherUUID', channels: ['testChannel'] }, | ||
(status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.channels, { | ||
testChannel: { age: 20, status: 'online' }, | ||
}); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
} | ||
); | ||
pubnub.getState({ uuid: 'otherUUID', channels: ['testChannel'] }, (status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.channels, { | ||
testChannel: { age: 20, status: 'online' }, | ||
}); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
}); | ||
}); | ||
@@ -365,5 +339,3 @@ | ||
.createNock() | ||
.get( | ||
'/v2/presence/sub-key/mySubscribeKey/channel/ch1%2Cch2/uuid/myUUID' | ||
) | ||
.get('/v2/presence/sub-key/mySubscribeKey/channel/ch1%2Cch2/uuid/myUUID') | ||
.query({ | ||
@@ -375,3 +347,3 @@ pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`, | ||
200, | ||
'{ "status": 200, "message": "OK", "payload": { "ch1": { "age" : 20, "status" : "online"}, "ch2": { "age": 100, "status": "offline" } }, "service": "Presence"}' | ||
'{ "status": 200, "message": "OK", "payload": { "ch1": { "age" : 20, "status" : "online"}, "ch2": { "age": 100, "status": "offline" } }, "service": "Presence"}', | ||
); | ||
@@ -393,5 +365,3 @@ | ||
.createNock() | ||
.get( | ||
'/v2/presence/sub-key/mySubscribeKey/channel/ch1%2Cch2/uuid/myUUID' | ||
) | ||
.get('/v2/presence/sub-key/mySubscribeKey/channel/ch1%2Cch2/uuid/myUUID') | ||
.query({ | ||
@@ -404,21 +374,21 @@ pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`, | ||
200, | ||
'{ "status": 200, "message": "OK", "payload": { "ch1": { "age" : 20, "status" : "online"}, "ch2": { "age": 100, "status": "offline" } }, "service": "Presence"}' | ||
'{ "status": 200, "message": "OK", "payload": { "ch1": { "age" : 20, "status" : "online"}, "ch2": { "age": 100, "status": "offline" } }, "service": "Presence"}', | ||
); | ||
pubnub.getState( | ||
{ channels: ['ch1', 'ch2'], channelGroups: ['cg1', 'cg2'] }, | ||
(status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.channels, { | ||
ch1: { age: 20, status: 'online' }, | ||
ch2: { age: 100, status: 'offline' }, | ||
}); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
} | ||
); | ||
pubnub.getState({ channels: ['ch1', 'ch2'], channelGroups: ['cg1', 'cg2'] }, (status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.channels, { | ||
ch1: { age: 20, status: 'online' }, | ||
ch2: { age: 100, status: 'offline' }, | ||
}); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
}); | ||
}); | ||
it('should add get state API telemetry information', (done) => { | ||
let scope = utils.createNock().get('/v2/presence/sub-key/mySubscribeKey/channel/testChannel/uuid/myUUID').query(true); | ||
let scope = utils | ||
.createNock() | ||
.get('/v2/presence/sub-key/mySubscribeKey/channel/testChannel/uuid/myUUID') | ||
.query(true); | ||
const delays = [100, 200, 300, 400]; | ||
@@ -429,12 +399,14 @@ const countedDelays = delays.slice(0, delays.length - 1); | ||
utils.runAPIWithResponseDelays(scope, | ||
200, | ||
'{ "status": 200, "message": "OK", "payload": { "age" : 20, "status" : "online"}, "service": "Presence"}', | ||
delays, | ||
(completion) => { | ||
pubnub.getState( | ||
{ channels: ['testChannel'] }, | ||
() => { completion(); } | ||
); | ||
}) | ||
utils | ||
.runAPIWithResponseDelays( | ||
scope, | ||
200, | ||
'{ "status": 200, "message": "OK", "payload": { "age" : 20, "status" : "online"}, "service": "Presence"}', | ||
delays, | ||
(completion) => { | ||
pubnub.getState({ channels: ['testChannel'] }, () => { | ||
completion(); | ||
}); | ||
}, | ||
) | ||
.then((lastRequest) => { | ||
@@ -458,3 +430,3 @@ utils.verifyRequestTelemetry(lastRequest.path, 'l_pres', average, leeway); | ||
200, | ||
'{"status": 200, "message": "OK", "uuids": ["a3ffd012-a3b9-478c-8705-64089f24d71e"], "occupancy": 1, "service": "Presence"}' | ||
'{"status": 200, "message": "OK", "uuids": ["a3ffd012-a3b9-478c-8705-64089f24d71e"], "occupancy": 1, "service": "Presence"}', | ||
); | ||
@@ -489,6 +461,3 @@ | ||
}) | ||
.reply( | ||
200, | ||
'{"status": 200, "message": "OK", "occupancy": 1, "service": "Presence"}' | ||
); | ||
.reply(200, '{"status": 200, "message": "OK", "occupancy": 1, "service": "Presence"}'); | ||
@@ -519,3 +488,3 @@ pubnub.hereNow({ channels: ['game1'] }, (status, response) => { | ||
200, | ||
'{"status": 200, "message": "OK", "payload": {"channels": {"game1": {"uuids": ["a3ffd012-a3b9-478c-8705-64089f24d71e"], "occupancy": 1}}, "total_channels": 1, "total_occupancy": 1}, "service": "Presence"}' | ||
'{"status": 200, "message": "OK", "payload": {"channels": {"game1": {"uuids": ["a3ffd012-a3b9-478c-8705-64089f24d71e"], "occupancy": 1}}, "total_channels": 1, "total_occupancy": 1}, "service": "Presence"}', | ||
); | ||
@@ -553,39 +522,36 @@ | ||
200, | ||
'{"status":200,"message":"OK","payload":{"total_occupancy":3,"total_channels":2,"channels":{"ch1":{"occupancy":1,"uuids":[{"uuid":"user1"}]},"ch2":{"occupancy":2,"uuids":[{"uuid":"user1"},{"uuid":"user3"}]}}},"service":"Presence"}' | ||
'{"status":200,"message":"OK","payload":{"total_occupancy":3,"total_channels":2,"channels":{"ch1":{"occupancy":1,"uuids":[{"uuid":"user1"}]},"ch2":{"occupancy":2,"uuids":[{"uuid":"user1"},{"uuid":"user3"}]}}},"service":"Presence"}', | ||
); | ||
pubnub.hereNow( | ||
{ channels: ['ch1', 'ch2'], includeState: true }, | ||
(status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.channels, { | ||
ch1: { | ||
name: 'ch1', | ||
occupancy: 1, | ||
occupants: [ | ||
{ | ||
state: undefined, | ||
uuid: 'user1', | ||
}, | ||
], | ||
}, | ||
ch2: { | ||
name: 'ch2', | ||
occupancy: 2, | ||
occupants: [ | ||
{ | ||
state: undefined, | ||
uuid: 'user1', | ||
}, | ||
{ | ||
state: undefined, | ||
uuid: 'user3', | ||
}, | ||
], | ||
}, | ||
}); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
} | ||
); | ||
pubnub.hereNow({ channels: ['ch1', 'ch2'], includeState: true }, (status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.channels, { | ||
ch1: { | ||
name: 'ch1', | ||
occupancy: 1, | ||
occupants: [ | ||
{ | ||
state: undefined, | ||
uuid: 'user1', | ||
}, | ||
], | ||
}, | ||
ch2: { | ||
name: 'ch2', | ||
occupancy: 2, | ||
occupants: [ | ||
{ | ||
state: undefined, | ||
uuid: 'user1', | ||
}, | ||
{ | ||
state: undefined, | ||
uuid: 'user3', | ||
}, | ||
], | ||
}, | ||
}); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
}); | ||
}); | ||
@@ -604,25 +570,22 @@ | ||
200, | ||
'{"status":200,"message":"OK","payload":{"total_occupancy":3,"total_channels":2,"channels":{"ch1":{"occupancy":1,"uuids":[{"uuid":"user1"}]},"ch2":{"occupancy":2,"uuids":[{"uuid":"user1"},{"uuid":"user3"}]}}},"service":"Presence"}' | ||
'{"status":200,"message":"OK","payload":{"total_occupancy":3,"total_channels":2,"channels":{"ch1":{"occupancy":1,"uuids":[{"uuid":"user1"}]},"ch2":{"occupancy":2,"uuids":[{"uuid":"user1"},{"uuid":"user3"}]}}},"service":"Presence"}', | ||
); | ||
pubnub.hereNow( | ||
{ channels: ['ch1', 'ch2'], includeUUIDs: false }, | ||
(status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.channels, { | ||
ch1: { | ||
name: 'ch1', | ||
occupancy: 1, | ||
occupants: [], | ||
}, | ||
ch2: { | ||
name: 'ch2', | ||
occupancy: 2, | ||
occupants: [], | ||
}, | ||
}); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
} | ||
); | ||
pubnub.hereNow({ channels: ['ch1', 'ch2'], includeUUIDs: false }, (status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.channels, { | ||
ch1: { | ||
name: 'ch1', | ||
occupancy: 1, | ||
occupants: [], | ||
}, | ||
ch2: { | ||
name: 'ch2', | ||
occupancy: 2, | ||
occupants: [], | ||
}, | ||
}); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
}); | ||
}); | ||
@@ -641,3 +604,3 @@ | ||
200, | ||
' {"status": 200, "message": "OK", "payload": {"channels": {"ch1": {"uuids": ["a581c974-e2f9-4088-9cc8-9632708e012d"], "occupancy": 1}}, "total_channels": 1, "total_occupancy": 1}, "service": "Presence"}' | ||
' {"status": 200, "message": "OK", "payload": {"channels": {"ch1": {"uuids": ["a581c974-e2f9-4088-9cc8-9632708e012d"], "occupancy": 1}}, "total_channels": 1, "total_occupancy": 1}, "service": "Presence"}', | ||
); | ||
@@ -674,3 +637,3 @@ | ||
200, | ||
'{"status": 200, "message": "OK", "payload": {"channels": {"ch10": {"uuids": ["2c3b136e-dc9e-4e97-939c-752dbb47acbd"], "occupancy": 1}, "bot_object": {"uuids": ["fb49e109-756f-483e-92dc-d966d73a119d"], "occupancy": 1}}, "total_channels": 2, "total_occupancy": 2}, "service": "Presence"}' | ||
'{"status": 200, "message": "OK", "payload": {"channels": {"ch10": {"uuids": ["2c3b136e-dc9e-4e97-939c-752dbb47acbd"], "occupancy": 1}, "bot_object": {"uuids": ["fb49e109-756f-483e-92dc-d966d73a119d"], "occupancy": 1}}, "total_channels": 2, "total_occupancy": 2}, "service": "Presence"}', | ||
); | ||
@@ -718,3 +681,3 @@ | ||
200, | ||
'{"status": 200, "message": "OK", "payload": {"channels": {"ch10": {"occupancy": 1}, "bot_object": {"occupancy": 1}}, "total_channels": 2, "total_occupancy": 2}, "service": "Presence"}' | ||
'{"status": 200, "message": "OK", "payload": {"channels": {"ch10": {"occupancy": 1}, "bot_object": {"occupancy": 1}}, "total_channels": 2, "total_occupancy": 2}, "service": "Presence"}', | ||
); | ||
@@ -750,6 +713,3 @@ | ||
}) | ||
.reply( | ||
200, | ||
'{"status": 503, "message": "Service Unavailable", "error": 1, "service": "Presence"}' | ||
); | ||
.reply(200, '{"status": 503, "message": "Service Unavailable", "error": 1, "service": "Presence"}'); | ||
@@ -773,6 +733,7 @@ pubnub.hereNow({ includeUUIDs: false }, (status) => { | ||
200, | ||
'{"status": 402, "error": 1, "message": "This feature is not turned on for this account. Contact support@pubnub.com to activate this feature.", "service": "Presence"}' | ||
'{"status": 402, "error": 1, "message": "This feature is not turned on for this account. Contact support@pubnub.com to activate this feature.", "service": "Presence"}', | ||
); | ||
let expected = 'You have tried to perform a Global Here Now operation, your keyset configuration does not support that. Please provide a channel, or enable the Global Here Now feature from the Portal.'; | ||
pubnub.hereNow({channles: []}, (status) => { | ||
let expected = | ||
'You have tried to perform a Global Here Now operation, your keyset configuration does not support that. Please provide a channel, or enable the Global Here Now feature from the Portal.'; | ||
pubnub.hereNow({ channles: [] }, (status) => { | ||
assert.equal(status.error, true); | ||
@@ -792,7 +753,7 @@ assert.equal(status.errorData.message, expected); | ||
uuid: 'myUUID', | ||
test: 'param' | ||
test: 'param', | ||
}) | ||
.reply( | ||
200, | ||
'{"status": 200, "message": "OK", "uuids": ["a3ffd012-a3b9-478c-8705-64089f24d71e"], "occupancy": 1, "service": "Presence"}' | ||
'{"status": 200, "message": "OK", "uuids": ["a3ffd012-a3b9-478c-8705-64089f24d71e"], "occupancy": 1, "service": "Presence"}', | ||
); | ||
@@ -826,12 +787,14 @@ | ||
utils.runAPIWithResponseDelays(scope, | ||
200, | ||
'{"status": 200, "message": "OK", "uuids": ["a3ffd012-a3b9-478c-8705-64089f24d71e"], "occupancy": 1, "service": "Presence"}', | ||
delays, | ||
(completion) => { | ||
pubnub.hereNow( | ||
{ channels: ['game1'] }, | ||
() => { completion(); } | ||
); | ||
}) | ||
utils | ||
.runAPIWithResponseDelays( | ||
scope, | ||
200, | ||
'{"status": 200, "message": "OK", "uuids": ["a3ffd012-a3b9-478c-8705-64089f24d71e"], "occupancy": 1, "service": "Presence"}', | ||
delays, | ||
(completion) => { | ||
pubnub.hereNow({ channels: ['game1'] }, () => { | ||
completion(); | ||
}); | ||
}, | ||
) | ||
.then((lastRequest) => { | ||
@@ -838,0 +801,0 @@ utils.verifyRequestTelemetry(lastRequest.path, 'l_pres', average, leeway); |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4605474
332
41075