comprodls-sdk 2.75.2 → 2.75.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -86,19 +86,16 @@ function _connect(pubnubCW, options) {
|
|
|
86
86
|
|
|
87
87
|
function _cleanup(pubnubCW) { pubnubCW.cleanup(); }
|
|
88
88
|
|
|
89
|
-
/*options = {
|
|
90
|
-
orgId: <orgId>, userId: <userId>
|
|
91
|
-
}*/
|
|
89
|
+
/*options = {}*/
|
|
92
90
|
function grantByUserOrgId(options) {
|
|
93
91
|
var dfd = q.defer(); // Initializing promise
|
|
94
92
|
var allowedChannels = ['jobs', 'systemevents'];
|
|
95
|
-
var baseChannelName = "o-" +
|
|
93
|
+
var baseChannelName = "o-" + this.orgId + "\\$u-" + this.token.access_token + "\\$";
|
|
96
94
|
var patterns = [];
|
|
97
95
|
for(var i in allowedChannels) {
|
|
98
96
|
var channelName = baseChannelName + allowedChannels[i] + "\\..*";
|
|
99
97
|
patterns.push(channelName);
|
|
100
98
|
}
|
|
101
|
-
console.log("0a781d69 TAKING GRANT FOR CHANNEL PATTERNS: ", patterns);
|
|
102
99
|
options.channels = {};
|
|
103
100
|
options.channels.patterns = patterns;
|
|
104
101
|
grantV2.call(this, options)
|
|
@@ -36,7 +36,6 @@ module.exports = function () {
|
|
|
36
36
|
//Returning the adaptor (Plain Javascript object)
|
|
37
37
|
return {
|
|
38
38
|
"on": function (channelObj, handler) {
|
|
39
|
-
console.log("0a781d69 PARAMS OF .on FUNCTION: ", JSON.stringify(channelObj, null, 2));
|
|
40
39
|
var pubNubChannel;
|
|
41
40
|
var channelContext = [];
|
|
42
41
|
|
|
@@ -58,7 +57,6 @@ module.exports = function () {
|
|
|
58
57
|
status: 'pending'
|
|
59
58
|
};
|
|
60
59
|
_eventEmitter.on(pubNubChannel, handler);
|
|
61
|
-
console.log("0a781d69 GOING TO SUBSCRIBE ON PUBNUB CHANNEL: ", pubNubChannel);
|
|
62
60
|
_subscribeToPubNubChannels(pubNubChannel);
|
|
63
61
|
}
|
|
64
62
|
}
|
|
@@ -79,7 +77,6 @@ module.exports = function () {
|
|
|
79
77
|
|
|
80
78
|
var _translatePubnubStatus = function(status, options) {
|
|
81
79
|
var channels = [], error, successObj;
|
|
82
|
-
console.log('0a781d69 PUBNUB STATUS: ', JSON.stringify(status, null, 4));
|
|
83
80
|
switch (status.category) {
|
|
84
81
|
case "PNConnectedCategory":
|
|
85
82
|
if(status.operation === "PNSubscribeOperation") {
|
|
@@ -216,14 +213,9 @@ module.exports = function () {
|
|
|
216
213
|
var token = userOptions.token;
|
|
217
214
|
|
|
218
215
|
if (!_pubnubClient && pubnubConfig) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
setTimeout(processSetup, 1000);
|
|
223
|
-
processSetup();
|
|
224
|
-
} catch(err) {
|
|
225
|
-
console.error('0a781d69 ERROR WHILE CONFIGURING PUBNUB: ', JSON.stringify(err, null, 2));
|
|
226
|
-
}
|
|
216
|
+
_pubnubClient = new pubNub(pubnubConfig); //Connect with PubNub SDK
|
|
217
|
+
_pubnubClient.setToken(token);
|
|
218
|
+
processSetup();
|
|
227
219
|
} else {
|
|
228
220
|
return new Error('Already Initialized');
|
|
229
221
|
}
|