comprodls-sdk 2.72.4 → 2.73.0
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.
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
var ERROR_TYPES = {
|
|
27
27
|
"API_ERROR": "API_ERROR",
|
|
28
28
|
"SDK_ERROR": "SDK_ERROR",
|
|
29
|
-
"CHANNEL_SUBSCRIPTION": "CHANNEL_SUBSCRIPTION"
|
|
29
|
+
"CHANNEL_SUBSCRIPTION": "CHANNEL_SUBSCRIPTION",
|
|
30
|
+
"UNEXPECTED_ERROR": "UNEXPECTED_ERROR"
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
var ERROR_CATEGORY = {
|
|
@@ -117,7 +118,7 @@ function PUSHXError(category, error) {
|
|
|
117
118
|
|
|
118
119
|
if (category === ERROR_CATEGORY.PUSHX) {
|
|
119
120
|
this.category = ERROR_CATEGORY.PUSHX;
|
|
120
|
-
this.type = ERROR_TYPES.CHANNEL_SUBSCRIPTION;
|
|
121
|
+
this.type = error.type || ERROR_TYPES.CHANNEL_SUBSCRIPTION;
|
|
121
122
|
this.status = ERROR_STATUS.ERROR;
|
|
122
123
|
this.message = error.message;
|
|
123
124
|
this.data = error;
|
|
@@ -45,7 +45,8 @@ var keepaliveAgent = new Agent({
|
|
|
45
45
|
/*********************************
|
|
46
46
|
* Public Function definitions
|
|
47
47
|
**********************************/
|
|
48
|
-
function pushX() {
|
|
48
|
+
function pushX(accountId) {
|
|
49
|
+
this.accountId = accountId;
|
|
49
50
|
var _pubnubClientWrapper = pubnubClientWrapper();
|
|
50
51
|
return {
|
|
51
52
|
"connect": _connect.bind(this, _pubnubClientWrapper),
|
|
@@ -62,6 +63,7 @@ function pushX() {
|
|
|
62
63
|
**********************************/
|
|
63
64
|
|
|
64
65
|
function _connect(pubnubCW, options) {
|
|
66
|
+
var self = this;
|
|
65
67
|
var bpubnubV7 = true; // If pubnub v7 or higher in package.json, set it true
|
|
66
68
|
if (bpubnubV7 && !options.userid) {
|
|
67
69
|
var err = {};
|
|
@@ -73,6 +75,7 @@ function _connect(pubnubCW, options) {
|
|
|
73
75
|
// Adding SSL flag
|
|
74
76
|
return pubnubCW.setup({
|
|
75
77
|
'userid': options.userid,
|
|
78
|
+
'accountid': self.accountId,
|
|
76
79
|
'pubnub': {
|
|
77
80
|
'publishKey': options.publishKey,
|
|
78
81
|
'subscribeKey': options.subscribeKey,
|
|
@@ -134,6 +134,34 @@ module.exports = function () {
|
|
|
134
134
|
error = new PUSHXError(helpers.errors.ERROR_CATEGORY.PUSHX, error);
|
|
135
135
|
_eventEmitter.emit('pushx_status', error);
|
|
136
136
|
break;
|
|
137
|
+
case "PNNetworkIssuesCategory":
|
|
138
|
+
if(status.operation === 'PNSubscribeOperation') {
|
|
139
|
+
/**
|
|
140
|
+
* Handle network issue category status for 'subscription' opreration
|
|
141
|
+
* Start the events polling here.
|
|
142
|
+
*
|
|
143
|
+
* The wrapper supports multiple channels, but the APP currently uses a single channel only.
|
|
144
|
+
* Polling will also limited to a single channel.
|
|
145
|
+
*/
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
// Handle network issue category status for other operations like 'unsubscription'
|
|
149
|
+
}
|
|
150
|
+
break;
|
|
151
|
+
case "PNReconnectedCategory":
|
|
152
|
+
// Handle reconnected category status.
|
|
153
|
+
break;
|
|
154
|
+
default:
|
|
155
|
+
// Emit error for other status-category received from pubnub
|
|
156
|
+
error = {
|
|
157
|
+
message: "PushX Error",
|
|
158
|
+
status: status.statusCode,
|
|
159
|
+
type: helpers.errors.ERROR_TYPES.UNEXPECTED_ERROR,
|
|
160
|
+
pushXError: status
|
|
161
|
+
};
|
|
162
|
+
error = new PUSHXError(helpers.errors.ERROR_CATEGORY.PUSHX, error);
|
|
163
|
+
_eventEmitter.emit('pushx_status', error);
|
|
164
|
+
break;
|
|
137
165
|
}
|
|
138
166
|
};
|
|
139
167
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comprodls-sdk",
|
|
3
3
|
"description": "comproDLS SDK for JavaScript",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.73.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Compro Technologies Private Limited",
|
|
7
7
|
"url": "http://www.comprotechnologies.com/"
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"validate.js": "^0.9.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"grunt": "
|
|
25
|
-
"grunt-browserify": "
|
|
26
|
-
"grunt-contrib-clean": "
|
|
27
|
-
"grunt-contrib-uglify": "
|
|
24
|
+
"grunt": "^0.4.5",
|
|
25
|
+
"grunt-browserify": "^4.0.1",
|
|
26
|
+
"grunt-contrib-clean": "^1.0.0",
|
|
27
|
+
"grunt-contrib-uglify": "4.0.1",
|
|
28
28
|
"semver": "^5.1.0",
|
|
29
29
|
"shelljs": "^0.6.0"
|
|
30
30
|
}
|