podchat-browser 12.9.6-snapshot.4 → 12.9.6
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.
- package/changelog.md +30 -2
- package/dist/node/buildConfig.json +1 -1
- package/dist/node/chat.js +52 -15
- package/dist/node/messaging.module.js +1 -0
- package/dist/podchat-browser-bundle.js +52 -22
- package/package.json +1 -1
- package/src/buildConfig.json +1 -1
- package/src/chat.js +51 -12
- package/src/messaging.module.js +1 -0
package/changelog.md
CHANGED
|
@@ -3,11 +3,39 @@
|
|
|
3
3
|
All notable changes to this project will be documented here.
|
|
4
4
|
to see complete list of changelog please visit [ChangeLog](http://gp.fanapsoft.ir/pod/pod-basic-sdk/chat-js-browser-sdk/-/blob/master/changelog.md)
|
|
5
5
|
|
|
6
|
-
##[Unreleased]
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
## [12.9.6] 29-07-2023
|
|
9
|
+
## [12.9.6-snapshot.4] 19-07-2023
|
|
10
|
+
## [12.9.6-snapshot.3] 19-07-2023
|
|
11
|
+
## [12.9.6-snapshot.2] 19-07-2023
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- Implemented mode: auto switch between async protocols
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- window is undefined error in Next.js projects
|
|
18
|
+
- Modified 31:LAST_SEEN_UPDATED unreadCount cache condition to prevent errors
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## [12.9.6-snapshot.1] 11-07-2023
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- Update podasync-ws-only@2.9.0-snapshot.10
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## [12.9.6-snapshot.0] 09-07-2023
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- Merge default count=25, offset=0
|
|
31
|
+
- Merge sdkParams in separate module
|
|
32
|
+
|
|
33
|
+
###Fixed
|
|
34
|
+
- Fixed store error for not loaded thread on type 31 (unreadCount cache)
|
|
7
35
|
|
|
8
36
|
## [12.9.5] 2023-07-09
|
|
9
37
|
|
|
10
|
-
|
|
38
|
+
### Changed
|
|
11
39
|
- remove old cache
|
|
12
40
|
- Modification on unreadCount cache to prevent unwanted higher unreadCount on event unread_count_updated
|
|
13
41
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"12.9.6
|
|
1
|
+
{"version":"12.9.6","date":"۱۴۰۲/۵/۷","VersionInfo":"Release: true, Snapshot: false, Is For Test: false"}
|
package/dist/node/chat.js
CHANGED
|
@@ -249,11 +249,16 @@ function Chat(params) {
|
|
|
249
249
|
currentProtocol: protocol == "auto" ? 'websocket' : protocol,
|
|
250
250
|
failOverProtocol: protocol == "auto" || protocol == "websocket" ? 'webrtc' : 'websocket',
|
|
251
251
|
retries: 0,
|
|
252
|
-
allowedRetries:
|
|
252
|
+
allowedRetries: {
|
|
253
|
+
websocket: 2,
|
|
254
|
+
webrtc: 1
|
|
255
|
+
},
|
|
256
|
+
reconnectAsyncRequest: false,
|
|
257
|
+
currentWaitTime: 0
|
|
253
258
|
};
|
|
254
259
|
|
|
255
260
|
function _canRetry() {
|
|
256
|
-
return config.retries < config.allowedRetries;
|
|
261
|
+
return config.retries < config.allowedRetries[config.currentProtocol];
|
|
257
262
|
}
|
|
258
263
|
|
|
259
264
|
function _switchProtocol(protocol) {
|
|
@@ -271,10 +276,7 @@ function Chat(params) {
|
|
|
271
276
|
config.failOverProtocol = current;
|
|
272
277
|
}
|
|
273
278
|
|
|
274
|
-
console.log("
|
|
275
|
-
current: config.currentProtocol,
|
|
276
|
-
prev: config.failOverProtocol
|
|
277
|
-
});
|
|
279
|
+
_sdkParams.sdkParams.consoleLogging && console.log("[SDK]|/| switchProtocol: ", "config.currentProtocol: ", config.currentProtocol, "config.currentWaitTime: ", config.currentWaitTime);
|
|
278
280
|
|
|
279
281
|
_events.chatEvents.fireEvent("autoSwitchAsyncProtocol", {
|
|
280
282
|
current: config.currentProtocol,
|
|
@@ -283,6 +285,7 @@ function Chat(params) {
|
|
|
283
285
|
|
|
284
286
|
_resetRetries();
|
|
285
287
|
|
|
288
|
+
config.reconnectAsyncRequest = false;
|
|
286
289
|
initAsync();
|
|
287
290
|
});
|
|
288
291
|
asyncClient.logout();
|
|
@@ -292,7 +295,7 @@ function Chat(params) {
|
|
|
292
295
|
config.retries = 0;
|
|
293
296
|
}
|
|
294
297
|
|
|
295
|
-
|
|
298
|
+
var publics = {
|
|
296
299
|
switchProtocol: function switchProtocol(protocol) {
|
|
297
300
|
if (protocol == 'auto') {
|
|
298
301
|
config.switchingEnabled = true;
|
|
@@ -316,12 +319,42 @@ function Chat(params) {
|
|
|
316
319
|
resetRetries: function resetRetries() {
|
|
317
320
|
_resetRetries();
|
|
318
321
|
},
|
|
319
|
-
|
|
322
|
+
onAsyncIsReconnecting: function onAsyncIsReconnecting(event) {
|
|
323
|
+
_sdkParams.sdkParams.consoleLogging && console.log("[SDK]|/| onAsyncIsReconnecting: ", "config.currentProtocol: ", config.currentProtocol, "config.currentWaitTime: ", config.currentWaitTime);
|
|
324
|
+
publics.increaseRetries();
|
|
325
|
+
|
|
326
|
+
if (config.currentWaitTime < 64) {
|
|
327
|
+
config.currentWaitTime += 3;
|
|
328
|
+
} //config.currentWaitTime = event.nextTime
|
|
329
|
+
|
|
330
|
+
|
|
320
331
|
if (!_canRetry() && config.switchingEnabled) {
|
|
321
332
|
_switchProtocol();
|
|
322
333
|
}
|
|
334
|
+
},
|
|
335
|
+
getRetryStepTimerTime: function getRetryStepTimerTime() {
|
|
336
|
+
if (config.switchingEnabled) return config.currentWaitTime;else return 4;
|
|
337
|
+
},
|
|
338
|
+
reconnectAsync: function reconnectAsync() {
|
|
339
|
+
config.reconnectAsyncRequest = true;
|
|
340
|
+
config.currentWaitTime = 0;
|
|
341
|
+
|
|
342
|
+
if (config.switchingEnabled) {
|
|
343
|
+
if (!_canRetry()) {
|
|
344
|
+
_switchProtocol();
|
|
345
|
+
} else {
|
|
346
|
+
_switchProtocol(config.currentProtocol);
|
|
347
|
+
}
|
|
348
|
+
} else {
|
|
349
|
+
if (!_canRetry()) {
|
|
350
|
+
_switchProtocol();
|
|
351
|
+
} else {
|
|
352
|
+
_switchProtocol(config.currentProtocol);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
323
355
|
}
|
|
324
356
|
};
|
|
357
|
+
return publics;
|
|
325
358
|
}
|
|
326
359
|
/*******************************************************
|
|
327
360
|
* P R I V A T E M E T H O D S *
|
|
@@ -382,7 +415,9 @@ function Chat(params) {
|
|
|
382
415
|
reconnectOnClose: _sdkParams.sdkParams.reconnectOnClose,
|
|
383
416
|
asyncLogging: _sdkParams.sdkParams.asyncLogging,
|
|
384
417
|
logLevel: _sdkParams.sdkParams.consoleLogging ? 3 : 1,
|
|
385
|
-
webrtcConfig: _sdkParams.sdkParams.webrtcConfig
|
|
418
|
+
webrtcConfig: _sdkParams.sdkParams.webrtcConfig,
|
|
419
|
+
retryStepTimerTime: protocolManager.getRetryStepTimerTime(),
|
|
420
|
+
onStartWithRetryStepGreaterThanZero: onStateChange
|
|
386
421
|
});
|
|
387
422
|
callModule.asyncInitialized(asyncClient);
|
|
388
423
|
chatMessaging.asyncInitialized(asyncClient);
|
|
@@ -416,7 +451,9 @@ function Chat(params) {
|
|
|
416
451
|
}
|
|
417
452
|
}, _sdkParams.sdkParams.seenIntervalPitch); //shouldReconnectCall();
|
|
418
453
|
});
|
|
419
|
-
asyncClient.on('stateChange',
|
|
454
|
+
asyncClient.on('stateChange', onStateChange);
|
|
455
|
+
|
|
456
|
+
function onStateChange(state) {
|
|
420
457
|
_events.chatEvents.fireEvent('chatState', state);
|
|
421
458
|
|
|
422
459
|
chatFullStateObject = state;
|
|
@@ -454,7 +491,8 @@ function Chat(params) {
|
|
|
454
491
|
|
|
455
492
|
break;
|
|
456
493
|
}
|
|
457
|
-
}
|
|
494
|
+
}
|
|
495
|
+
|
|
458
496
|
asyncClient.on('connect', function (newPeerId) {
|
|
459
497
|
asyncGetReadyTime = new Date().getTime();
|
|
460
498
|
peerId = newPeerId;
|
|
@@ -481,10 +519,9 @@ function Chat(params) {
|
|
|
481
519
|
|
|
482
520
|
_events.chatEvents.fireEvent('reconnect');
|
|
483
521
|
});
|
|
484
|
-
asyncClient.on('reconnecting', function () {
|
|
522
|
+
asyncClient.on('reconnecting', function (event) {
|
|
485
523
|
_sdkParams.sdkParams.consoleLogging && console.log("[SDK][event: asyncClient.reconnecting]");
|
|
486
|
-
protocolManager.
|
|
487
|
-
protocolManager.maybeSwitchProtocol();
|
|
524
|
+
protocolManager.onAsyncIsReconnecting(event);
|
|
488
525
|
});
|
|
489
526
|
asyncClient.on('message', function (params, ack) {
|
|
490
527
|
receivedAsyncMessageHandler(params);
|
|
@@ -11743,7 +11780,7 @@ function Chat(params) {
|
|
|
11743
11780
|
};
|
|
11744
11781
|
|
|
11745
11782
|
publicized.reconnect = function () {
|
|
11746
|
-
|
|
11783
|
+
protocolManager.reconnectAsync();
|
|
11747
11784
|
};
|
|
11748
11785
|
|
|
11749
11786
|
publicized.setToken = function (newToken) {
|
|
@@ -52,6 +52,7 @@ function ChatMessaging(params) {
|
|
|
52
52
|
*/
|
|
53
53
|
|
|
54
54
|
this.startChatPing = function () {
|
|
55
|
+
_sdkParams.sdkParams.chatPingMessageInterval && clearInterval(_sdkParams.sdkParams.chatPingMessageInterval);
|
|
55
56
|
_sdkParams.sdkParams.chatPingMessageInterval = setInterval(function () {
|
|
56
57
|
currentModuleInstance.ping();
|
|
57
58
|
}, 20000); //TODO: chatPingMessageInterval
|
|
@@ -42,6 +42,7 @@ function Async(params) {
|
|
|
42
42
|
var protocol = params.protocol || 'websocket',
|
|
43
43
|
appId = params.appId || 'PodChat',
|
|
44
44
|
deviceId = params.deviceId,
|
|
45
|
+
retryStepTimerTime = typeof params.retryStepTimerTime != "undefined" ? params.retryStepTimerTime : 0,
|
|
45
46
|
eventCallbacks = {
|
|
46
47
|
connect: {},
|
|
47
48
|
disconnect: {},
|
|
@@ -108,7 +109,8 @@ function Async(params) {
|
|
|
108
109
|
onSendLogging = params.asyncLogging && typeof params.asyncLogging.onMessageSend === 'boolean' ? params.asyncLogging.onMessageSend : false,
|
|
109
110
|
workerId = params.asyncLogging && typeof parseInt(params.asyncLogging.workerId) === 'number' ? params.asyncLogging.workerId : 0,
|
|
110
111
|
webrtcConfig = params.webrtcConfig ? params.webrtcConfig : null,
|
|
111
|
-
isLoggedOut = false
|
|
112
|
+
isLoggedOut = false,
|
|
113
|
+
onStartWithRetryStepGreaterThanZero = params.onStartWithRetryStepGreaterThanZero;
|
|
112
114
|
var reconnOnClose = {
|
|
113
115
|
value: false,
|
|
114
116
|
oldValue: null,
|
|
@@ -127,7 +129,7 @@ function Async(params) {
|
|
|
127
129
|
};
|
|
128
130
|
reconnOnClose.set(reconnectOnClose);
|
|
129
131
|
var retryStep = {
|
|
130
|
-
value:
|
|
132
|
+
value: retryStepTimerTime,
|
|
131
133
|
get: function get() {
|
|
132
134
|
return retryStep.value;
|
|
133
135
|
},
|
|
@@ -142,14 +144,26 @@ function Async(params) {
|
|
|
142
144
|
*******************************************************/
|
|
143
145
|
|
|
144
146
|
var init = function init() {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
147
|
+
if (retryStep.get() > 0) {
|
|
148
|
+
onStartWithRetryStepGreaterThanZero && onStartWithRetryStepGreaterThanZero({
|
|
149
|
+
socketState: socketStateType.CLOSED,
|
|
150
|
+
timeUntilReconnect: 1000 * retryStep.get(),
|
|
151
|
+
deviceRegister: false,
|
|
152
|
+
serverRegister: false,
|
|
153
|
+
peerId: peerId
|
|
154
|
+
});
|
|
152
155
|
}
|
|
156
|
+
socketReconnectRetryInterval = setTimeout(function () {
|
|
157
|
+
if (isLoggedOut) return;
|
|
158
|
+
switch (protocol) {
|
|
159
|
+
case 'websocket':
|
|
160
|
+
initSocket();
|
|
161
|
+
break;
|
|
162
|
+
case 'webrtc':
|
|
163
|
+
initWebrtc();
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
}, 1000 * retryStep.get());
|
|
153
167
|
},
|
|
154
168
|
asyncLogger = function asyncLogger(type, msg) {
|
|
155
169
|
Utility.asyncLogger({
|
|
@@ -244,7 +258,9 @@ function Async(params) {
|
|
|
244
258
|
if (isLoggedOut) return;
|
|
245
259
|
socket.connect();
|
|
246
260
|
setTimeout(function () {
|
|
247
|
-
fireEvent("reconnecting"
|
|
261
|
+
fireEvent("reconnecting", {
|
|
262
|
+
nextTime: retryStep.get()
|
|
263
|
+
});
|
|
248
264
|
}, 5);
|
|
249
265
|
}, 1000 * retryStep.get());
|
|
250
266
|
if (retryStep.get() < 64) {
|
|
@@ -347,6 +363,7 @@ function Async(params) {
|
|
|
347
363
|
isSocketOpen = false;
|
|
348
364
|
isDeviceRegister = false;
|
|
349
365
|
oldPeerId = peerId;
|
|
366
|
+
socketState = socketStateType.CLOSED;
|
|
350
367
|
fireEvent('disconnect', event);
|
|
351
368
|
if (reconnOnClose.get() || reconnOnClose.getOld()) {
|
|
352
369
|
if (asyncLogging) {
|
|
@@ -357,7 +374,6 @@ function Async(params) {
|
|
|
357
374
|
}
|
|
358
375
|
}
|
|
359
376
|
logLevel.debug && console.debug("[Async][async.js] on connection close, retryStep:", retryStep.get());
|
|
360
|
-
socketState = socketStateType.CLOSED;
|
|
361
377
|
fireEvent('stateChange', {
|
|
362
378
|
socketState: socketState,
|
|
363
379
|
timeUntilReconnect: 1000 * retryStep.get(),
|
|
@@ -370,6 +386,11 @@ function Async(params) {
|
|
|
370
386
|
socketReconnectRetryInterval = setTimeout(function () {
|
|
371
387
|
if (isLoggedOut) return;
|
|
372
388
|
webRTCClass.connect();
|
|
389
|
+
setTimeout(function () {
|
|
390
|
+
fireEvent("reconnecting", {
|
|
391
|
+
nextTime: retryStep.get()
|
|
392
|
+
});
|
|
393
|
+
}, 5);
|
|
373
394
|
}, 1000 * retryStep.get());
|
|
374
395
|
if (retryStep.get() < 64) {
|
|
375
396
|
// retryStep += 3;
|
|
@@ -865,6 +886,9 @@ function Async(params) {
|
|
|
865
886
|
// webRTCClass.connect()
|
|
866
887
|
}, 4000);
|
|
867
888
|
};
|
|
889
|
+
this.setRetryTimerTime = function (seconds) {
|
|
890
|
+
retryStep.set(seconds);
|
|
891
|
+
};
|
|
868
892
|
this.generateUUID = Utility.generateUUID;
|
|
869
893
|
init();
|
|
870
894
|
}
|
|
@@ -1282,6 +1306,7 @@ function PingManager(params) {
|
|
|
1282
1306
|
}
|
|
1283
1307
|
|
|
1284
1308
|
function connect() {
|
|
1309
|
+
variables.isDestroyed = false;
|
|
1285
1310
|
webrtcFunctions.createPeerConnection();
|
|
1286
1311
|
}
|
|
1287
1312
|
var webrtcFunctions = {
|
|
@@ -1440,6 +1465,7 @@ var handshakingFunctions = {
|
|
|
1440
1465
|
var retries = variables.apiCallRetries.register;
|
|
1441
1466
|
return new Promise(promiseHandler);
|
|
1442
1467
|
function promiseHandler(resolve, reject) {
|
|
1468
|
+
if (variables.isDestroyed) return;
|
|
1443
1469
|
var registerEndPoint = getApiUrl() + defaultConfig.registerEndpoint;
|
|
1444
1470
|
fetch(registerEndPoint, {
|
|
1445
1471
|
method: "POST",
|
|
@@ -1474,12 +1500,13 @@ var handshakingFunctions = {
|
|
|
1474
1500
|
}
|
|
1475
1501
|
},
|
|
1476
1502
|
getCandidates: function getCandidates(clientId) {
|
|
1477
|
-
var
|
|
1478
|
-
|
|
1503
|
+
var getIceCandidateEndPoint = getApiUrl() + defaultConfig.getICEEndpoint;
|
|
1504
|
+
getIceCandidateEndPoint += "clientId=" + clientId;
|
|
1479
1505
|
var retries = variables.apiCallRetries.getIce;
|
|
1480
1506
|
return new Promise(promiseHandler);
|
|
1481
1507
|
function promiseHandler(resolve, reject) {
|
|
1482
|
-
|
|
1508
|
+
if (variables.isDestroyed) return;
|
|
1509
|
+
fetch(getIceCandidateEndPoint, {
|
|
1483
1510
|
method: "GET",
|
|
1484
1511
|
headers: {
|
|
1485
1512
|
"Content-Type": "application/json"
|
|
@@ -1523,6 +1550,7 @@ var handshakingFunctions = {
|
|
|
1523
1550
|
retries = variables.apiCallRetries.addIce;
|
|
1524
1551
|
return new Promise(promiseHandler);
|
|
1525
1552
|
function promiseHandler(resolve, reject) {
|
|
1553
|
+
if (variables.isDestroyed) return;
|
|
1526
1554
|
fetch(addIceCandidateEndPoint, {
|
|
1527
1555
|
method: "POST",
|
|
1528
1556
|
body: JSON.stringify({
|
|
@@ -1567,7 +1595,7 @@ function resetVariables() {
|
|
|
1567
1595
|
variables.deviceId = null;
|
|
1568
1596
|
variables.candidateManager.destroy();
|
|
1569
1597
|
variables.candidateManager = new CandidatesSendQueueManager();
|
|
1570
|
-
variables.isDestroyed = false;
|
|
1598
|
+
// variables.isDestroyed = false;
|
|
1571
1599
|
if (!variables.isDestroyed && variables.eventCallback["close"]) {
|
|
1572
1600
|
variables.eventCallback["close"]();
|
|
1573
1601
|
}
|
|
@@ -49089,7 +49117,7 @@ WildEmitter.mixin = function (constructor) {
|
|
|
49089
49117
|
WildEmitter.mixin(WildEmitter);
|
|
49090
49118
|
|
|
49091
49119
|
},{}],280:[function(require,module,exports){
|
|
49092
|
-
module.exports={"version":"12.9.6
|
|
49120
|
+
module.exports={"version":"12.9.6","date":"۱۴۰۲/۵/۷","VersionInfo":"Release: true, Snapshot: false, Is For Test: false"}
|
|
49093
49121
|
},{}],281:[function(require,module,exports){
|
|
49094
49122
|
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _typeof3=require("@babel/runtime/helpers/typeof");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _constants=require("./lib/constants");var _kurentoUtils=_interopRequireDefault(require("kurento-utils"));var _utility=_interopRequireDefault(require("./utility/utility"));var _eventsModule=require("./events.module.js");var _deviceManager=_interopRequireDefault(require("./lib/call/deviceManager.js"));var _errorHandler=_interopRequireWildcard(require("./lib/errorHandler"));var _sdkParams=require("./lib/sdkParams");function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||_typeof3(obj)!=="object"&&typeof obj!=="function"){return{"default":obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj["default"]=obj;if(cache){cache.set(obj,newObj);}return newObj;}function ChatCall(params){var _sdkParams$callOption,_sdkParams$callOption2;var//Utility = params.Utility,
|
|
49095
49123
|
currentModuleInstance=this,asyncClient=params.asyncClient,//chatEvents = params.chatEvents,
|
|
@@ -49904,8 +49932,9 @@ minIntegerValue=Number.MAX_SAFE_INTEGER*-1,maxIntegerValue=Number.MAX_SAFE_INTEG
|
|
|
49904
49932
|
//webrtcConfig = (params.webrtcConfig ? params.webrtcConfig : null);
|
|
49905
49933
|
if(!_sdkParams.sdkParams.consoleLogging){/**
|
|
49906
49934
|
* Disable kurento-utils logs
|
|
49907
|
-
*/window.Logger={error:function error(){},log:function log(){},debug:function debug(){}};}(0,_events.initEventHandler)(params);var chatMessaging=new _messaging["default"](Object.assign(params,{asyncClient:asyncClient})),callModule=new _call["default"](Object.assign(params,{asyncClient:asyncClient,chatMessaging:chatMessaging}));function ProtocolManager(_ref){var _ref$protocol=_ref.protocol,protocol=_ref$protocol===void 0?'auto':_ref$protocol;var config={switchingEnabled:protocol=="auto",currentProtocol:protocol=="auto"?'websocket':protocol,failOverProtocol:protocol=="auto"||protocol=="websocket"?'webrtc':'websocket',retries:0,allowedRetries:
|
|
49908
|
-
asyncClient.on('asyncDestroyed',function(){var current;if(protocol){current=protocol.toLowerCase();config.failOverProtocol=current=="webrtc"?"websocket":"webrtc";config.currentProtocol=current;}else{current=config.currentProtocol;config.currentProtocol=config.failOverProtocol;config.failOverProtocol=current;}console.log("
|
|
49935
|
+
*/window.Logger={error:function error(){},log:function log(){},debug:function debug(){}};}(0,_events.initEventHandler)(params);var chatMessaging=new _messaging["default"](Object.assign(params,{asyncClient:asyncClient})),callModule=new _call["default"](Object.assign(params,{asyncClient:asyncClient,chatMessaging:chatMessaging}));function ProtocolManager(_ref){var _ref$protocol=_ref.protocol,protocol=_ref$protocol===void 0?'auto':_ref$protocol;var config={switchingEnabled:protocol=="auto",currentProtocol:protocol=="auto"?'websocket':protocol,failOverProtocol:protocol=="auto"||protocol=="websocket"?'webrtc':'websocket',retries:0,allowedRetries:{websocket:2,webrtc:1},reconnectAsyncRequest:false,currentWaitTime:0};function _canRetry(){return config.retries<config.allowedRetries[config.currentProtocol];}function _switchProtocol(protocol){// sdkParams.protocol = current.toLowerCase();
|
|
49936
|
+
asyncClient.on('asyncDestroyed',function(){var current;if(protocol){current=protocol.toLowerCase();config.failOverProtocol=current=="webrtc"?"websocket":"webrtc";config.currentProtocol=current;}else{current=config.currentProtocol;config.currentProtocol=config.failOverProtocol;config.failOverProtocol=current;}_sdkParams.sdkParams.consoleLogging&&console.log("[SDK]|/| switchProtocol: ","config.currentProtocol: ",config.currentProtocol,"config.currentWaitTime: ",config.currentWaitTime);_events.chatEvents.fireEvent("autoSwitchAsyncProtocol",{current:config.currentProtocol,previous:config.failOverProtocol});_resetRetries();config.reconnectAsyncRequest=false;initAsync();});asyncClient.logout();}function _resetRetries(){config.retries=0;}var publics={switchProtocol:function switchProtocol(protocol){if(protocol=='auto'){config.switchingEnabled=true;_switchProtocol("websocket");}else{config.switchingEnabled=false;_switchProtocol(protocol);}},increaseRetries:function increaseRetries(){config.retries++;},canRetry:function canRetry(){return _canRetry();},getCurrentProtocol:function getCurrentProtocol(){return config.currentProtocol;},resetRetries:function resetRetries(){_resetRetries();},onAsyncIsReconnecting:function onAsyncIsReconnecting(event){_sdkParams.sdkParams.consoleLogging&&console.log("[SDK]|/| onAsyncIsReconnecting: ","config.currentProtocol: ",config.currentProtocol,"config.currentWaitTime: ",config.currentWaitTime);publics.increaseRetries();if(config.currentWaitTime<64){config.currentWaitTime+=3;}//config.currentWaitTime = event.nextTime
|
|
49937
|
+
if(!_canRetry()&&config.switchingEnabled){_switchProtocol();}},getRetryStepTimerTime:function getRetryStepTimerTime(){if(config.switchingEnabled)return config.currentWaitTime;else return 4;},reconnectAsync:function reconnectAsync(){config.reconnectAsyncRequest=true;config.currentWaitTime=0;if(config.switchingEnabled){if(!_canRetry()){_switchProtocol();}else{_switchProtocol(config.currentProtocol);}}else{if(!_canRetry()){_switchProtocol();}else{_switchProtocol(config.currentProtocol);}}}};return publics;}/*******************************************************
|
|
49909
49938
|
* P R I V A T E M E T H O D S *
|
|
49910
49939
|
*******************************************************/var init=function init(){/**
|
|
49911
49940
|
* Initialize Cache Databases
|
|
@@ -49921,8 +49950,8 @@ if(_sdkParams.sdkParams.grantDeviceIdFromSSO){var getDeviceIdWithTokenTime=new D
|
|
|
49921
49950
|
* @return {undefined}
|
|
49922
49951
|
* @return {undefined}
|
|
49923
49952
|
*/initAsync=function initAsync(){var asyncGetReadyTime=new Date().getTime();asyncClient=new _podasyncWsOnly["default"]({protocol:protocolManager.getCurrentProtocol(),//sdkParams.protocol,
|
|
49924
|
-
queueHost:queueHost,queuePort:queuePort,queueUsername:queueUsername,queuePassword:queuePassword,queueReceive:queueReceive,queueSend:queueSend,queueConnectionTimeout:queueConnectionTimeout,socketAddress:_sdkParams.sdkParams.socketAddress,serverName:_sdkParams.sdkParams.serverName,deviceId:_sdkParams.sdkParams.deviceId,wsConnectionWaitTime:_sdkParams.sdkParams.wsConnectionWaitTime,connectionRetryInterval:_sdkParams.sdkParams.connectionRetryInterval,connectionCheckTimeout:_sdkParams.sdkParams.connectionCheckTimeout,connectionCheckTimeoutThreshold:_sdkParams.sdkParams.connectionCheckTimeoutThreshold,messageTtl:_sdkParams.sdkParams.messageTtl,reconnectOnClose:_sdkParams.sdkParams.reconnectOnClose,asyncLogging:_sdkParams.sdkParams.asyncLogging,logLevel:_sdkParams.sdkParams.consoleLogging?3:1,webrtcConfig:_sdkParams.sdkParams.webrtcConfig});callModule.asyncInitialized(asyncClient);chatMessaging.asyncInitialized(asyncClient);asyncClient.on('asyncReady',function(){if(_sdkParams.sdkParams.actualTimingLog){_utility["default"].chatStepLogger('Async Connection ',new Date().getTime()-asyncGetReadyTime);}peerId=asyncClient.getPeerId();if(!chatMessaging.userInfo){getUserAndUpdateSDKState();}else if(chatMessaging.userInfo.id>0){chatMessaging.chatState=true;_events.chatEvents.fireEvent('chatReady');chatSendQueueHandler();}_sdkParams.sdkParams.deliveryInterval&&clearInterval(_sdkParams.sdkParams.deliveryInterval);_sdkParams.sdkParams.deliveryInterval=setInterval(function(){if(Object.keys(_sdkParams.sdkParams.messagesDelivery).length){messagesDeliveryQueueHandler();}},_sdkParams.sdkParams.deliveryIntervalPitch);_sdkParams.sdkParams.seenInterval&&clearInterval(_sdkParams.sdkParams.seenInterval);_sdkParams.sdkParams.seenInterval=setInterval(function(){if(Object.keys(_sdkParams.sdkParams.messagesSeen).length){messagesSeenQueueHandler();}},_sdkParams.sdkParams.seenIntervalPitch);//shouldReconnectCall();
|
|
49925
|
-
});asyncClient.on('stateChange',function(state){_events.chatEvents.fireEvent('chatState',state);chatFullStateObject=state;switch(state.socketState){case 1:// CONNECTED
|
|
49953
|
+
queueHost:queueHost,queuePort:queuePort,queueUsername:queueUsername,queuePassword:queuePassword,queueReceive:queueReceive,queueSend:queueSend,queueConnectionTimeout:queueConnectionTimeout,socketAddress:_sdkParams.sdkParams.socketAddress,serverName:_sdkParams.sdkParams.serverName,deviceId:_sdkParams.sdkParams.deviceId,wsConnectionWaitTime:_sdkParams.sdkParams.wsConnectionWaitTime,connectionRetryInterval:_sdkParams.sdkParams.connectionRetryInterval,connectionCheckTimeout:_sdkParams.sdkParams.connectionCheckTimeout,connectionCheckTimeoutThreshold:_sdkParams.sdkParams.connectionCheckTimeoutThreshold,messageTtl:_sdkParams.sdkParams.messageTtl,reconnectOnClose:_sdkParams.sdkParams.reconnectOnClose,asyncLogging:_sdkParams.sdkParams.asyncLogging,logLevel:_sdkParams.sdkParams.consoleLogging?3:1,webrtcConfig:_sdkParams.sdkParams.webrtcConfig,retryStepTimerTime:protocolManager.getRetryStepTimerTime(),onStartWithRetryStepGreaterThanZero:onStateChange});callModule.asyncInitialized(asyncClient);chatMessaging.asyncInitialized(asyncClient);asyncClient.on('asyncReady',function(){if(_sdkParams.sdkParams.actualTimingLog){_utility["default"].chatStepLogger('Async Connection ',new Date().getTime()-asyncGetReadyTime);}peerId=asyncClient.getPeerId();if(!chatMessaging.userInfo){getUserAndUpdateSDKState();}else if(chatMessaging.userInfo.id>0){chatMessaging.chatState=true;_events.chatEvents.fireEvent('chatReady');chatSendQueueHandler();}_sdkParams.sdkParams.deliveryInterval&&clearInterval(_sdkParams.sdkParams.deliveryInterval);_sdkParams.sdkParams.deliveryInterval=setInterval(function(){if(Object.keys(_sdkParams.sdkParams.messagesDelivery).length){messagesDeliveryQueueHandler();}},_sdkParams.sdkParams.deliveryIntervalPitch);_sdkParams.sdkParams.seenInterval&&clearInterval(_sdkParams.sdkParams.seenInterval);_sdkParams.sdkParams.seenInterval=setInterval(function(){if(Object.keys(_sdkParams.sdkParams.messagesSeen).length){messagesSeenQueueHandler();}},_sdkParams.sdkParams.seenIntervalPitch);//shouldReconnectCall();
|
|
49954
|
+
});asyncClient.on('stateChange',onStateChange);function onStateChange(state){_events.chatEvents.fireEvent('chatState',state);chatFullStateObject=state;switch(state.socketState){case 1:// CONNECTED
|
|
49926
49955
|
protocolManager.resetRetries();if(state.deviceRegister&&state.serverRegister){// chatMessaging.chatState = true;
|
|
49927
49956
|
// chatMessaging.ping();
|
|
49928
49957
|
chatMessaging.startChatPing();}break;case 0:// CONNECTING
|
|
@@ -49930,7 +49959,7 @@ chatMessaging.chatState=false;chatMessaging.stopChatPing();break;case 2:// CLOSI
|
|
|
49930
49959
|
chatMessaging.chatState=false;chatMessaging.stopChatPing();break;case 3:// CLOSED
|
|
49931
49960
|
chatMessaging.chatState=false;chatMessaging.stopChatPing();// TODO: Check if this is OK or not?!
|
|
49932
49961
|
//chatMessaging.sendPingTimeout && clearTimeout(chatMessaging.sendPingTimeout);
|
|
49933
|
-
break;}}
|
|
49962
|
+
break;}}asyncClient.on('connect',function(newPeerId){asyncGetReadyTime=new Date().getTime();peerId=newPeerId;_events.chatEvents.fireEvent('connect');chatMessaging.ping();});asyncClient.on('disconnect',function(event){oldPeerId=peerId;peerId=undefined;_events.chatEvents.fireEvent('disconnect',event);_events.chatEvents.fireEvent('callEvents',{type:'CALL_ERROR',code:7000,message:'Call Socket is closed!',error:event});});asyncClient.on('reconnect',function(newPeerId){peerId=newPeerId;_events.chatEvents.fireEvent('reconnect');});asyncClient.on('reconnecting',function(event){_sdkParams.sdkParams.consoleLogging&&console.log("[SDK][event: asyncClient.reconnecting]");protocolManager.onAsyncIsReconnecting(event);});asyncClient.on('message',function(params,ack){receivedAsyncMessageHandler(params);ack&&ack();});asyncClient.on('error',function(error){_events.chatEvents.fireEvent('error',{code:error.errorCode,message:error.errorMessage,error:error.errorEvent});});},getUserAndUpdateSDKState=function getUserAndUpdateSDKState(){var getUserInfoTime=new Date().getTime();getUserInfo(function(userInfoResult){if(_sdkParams.sdkParams.actualTimingLog){_utility["default"].chatStepLogger('Get User Info ',new Date().getTime()-getUserInfoTime);}if(!userInfoResult.hasError){chatMessaging.userInfo=userInfoResult.result.user;// getAllThreads({
|
|
49934
49963
|
// summary: true,
|
|
49935
49964
|
// cache: false
|
|
49936
49965
|
// });
|
|
@@ -51807,7 +51836,7 @@ content:{count:count,offset:offset}};if(params){if((0,_typeof2["default"])(param
|
|
|
51807
51836
|
* + locationPingRequest {object}
|
|
51808
51837
|
* + content {list} A map of { location: string, locationId: int }
|
|
51809
51838
|
*/var locationPingData={chatMessageVOType:_constants.chatMessageVOTypes.LOCATION_PING,typeCode:_sdkParams.sdkParams.generalTypeCode,//params.typeCode,
|
|
51810
|
-
pushMsgType:3,token:_sdkParams.sdkParams.token},content={};if(params){if(typeof params.location==='string'&&_sdkParams.sdkParams.locationPingTypes.hasOwnProperty(params.location.toUpperCase())){content.location=_sdkParams.sdkParams.locationPingTypes[params.location.toUpperCase()];if(params.location.toUpperCase()==='THREAD'){if(typeof params.threadId==='number'&¶ms.threadId>0){content.locationId=+params.threadId;}else{_events.chatEvents.fireEvent('error',{code:999,message:'You set the location to be a thread, you have to send a valid ThreadId'});return;}}}else{_events.chatEvents.fireEvent('error',{code:999,message:'Send a valid location type (CHAT / THREAD / CONTACTS)'});return;}locationPingData.content=JSON.stringify(content);}else{_events.chatEvents.fireEvent('error',{code:999,message:'No params have been sent to LocationPing!'});return;}return chatMessaging.sendMessage(locationPingData,{onResult:function onResult(result){callback&&callback(result);}});};publicized.clearChatServerCaches=clearChatServerCaches;publicized.deleteCacheDatabases=deleteCacheDatabases;publicized.clearCacheDatabasesOfUser=clearCacheDatabasesOfUser;publicized.getChatState=function(){return chatFullStateObject;};publicized.reconnect=function(){
|
|
51839
|
+
pushMsgType:3,token:_sdkParams.sdkParams.token},content={};if(params){if(typeof params.location==='string'&&_sdkParams.sdkParams.locationPingTypes.hasOwnProperty(params.location.toUpperCase())){content.location=_sdkParams.sdkParams.locationPingTypes[params.location.toUpperCase()];if(params.location.toUpperCase()==='THREAD'){if(typeof params.threadId==='number'&¶ms.threadId>0){content.locationId=+params.threadId;}else{_events.chatEvents.fireEvent('error',{code:999,message:'You set the location to be a thread, you have to send a valid ThreadId'});return;}}}else{_events.chatEvents.fireEvent('error',{code:999,message:'Send a valid location type (CHAT / THREAD / CONTACTS)'});return;}locationPingData.content=JSON.stringify(content);}else{_events.chatEvents.fireEvent('error',{code:999,message:'No params have been sent to LocationPing!'});return;}return chatMessaging.sendMessage(locationPingData,{onResult:function onResult(result){callback&&callback(result);}});};publicized.clearChatServerCaches=clearChatServerCaches;publicized.deleteCacheDatabases=deleteCacheDatabases;publicized.clearCacheDatabasesOfUser=clearCacheDatabasesOfUser;publicized.getChatState=function(){return chatFullStateObject;};publicized.reconnect=function(){protocolManager.reconnectAsync();};publicized.setToken=function(newToken){if(typeof newToken!=='undefined'){_sdkParams.sdkParams.token=newToken;_events.chatEvents.updateToken(_sdkParams.sdkParams.token);if(!chatMessaging.userInfo||!chatMessaging.userInfo.id){getUserAndUpdateSDKState();}}};publicized.generateUUID=_utility["default"].generateUUID;publicized.logout=function(){// clearChatServerCaches();
|
|
51811
51840
|
_events.chatEvents.clearEventCallbacks();chatMessaging.messagesCallbacks={};chatMessaging.sendMessageCallbacks={};chatMessaging.threadCallbacks={};chatMessaging.stopChatPing();asyncClient.logout();};publicized.inviteeIdTypes=_constants.inviteeVOidTypes;/**
|
|
51812
51841
|
* Check a turn server availability
|
|
51813
51842
|
*
|
|
@@ -53110,6 +53139,7 @@ function ChatMessaging(params) {
|
|
|
53110
53139
|
*/
|
|
53111
53140
|
|
|
53112
53141
|
this.startChatPing = function () {
|
|
53142
|
+
_sdkParams.sdkParams.chatPingMessageInterval && clearInterval(_sdkParams.sdkParams.chatPingMessageInterval);
|
|
53113
53143
|
_sdkParams.sdkParams.chatPingMessageInterval = setInterval(function () {
|
|
53114
53144
|
currentModuleInstance.ping();
|
|
53115
53145
|
}, 20000); //TODO: chatPingMessageInterval
|
package/package.json
CHANGED
package/src/buildConfig.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"12.9.6
|
|
1
|
+
{"version":"12.9.6","date":"۱۴۰۲/۵/۷","VersionInfo":"Release: true, Snapshot: false, Is For Test: false"}
|
package/src/chat.js
CHANGED
|
@@ -235,11 +235,16 @@ function Chat(params) {
|
|
|
235
235
|
currentProtocol: (protocol == "auto" ? 'websocket' : protocol),
|
|
236
236
|
failOverProtocol: (protocol == "auto" || protocol == "websocket" ? 'webrtc' : 'websocket'),
|
|
237
237
|
retries: 0,
|
|
238
|
-
allowedRetries:
|
|
238
|
+
allowedRetries: {
|
|
239
|
+
websocket: 2,
|
|
240
|
+
webrtc: 1
|
|
241
|
+
},
|
|
242
|
+
reconnectAsyncRequest: false,
|
|
243
|
+
currentWaitTime: 0
|
|
239
244
|
};
|
|
240
245
|
|
|
241
246
|
function canRetry() {
|
|
242
|
-
return config.retries < config.allowedRetries;
|
|
247
|
+
return config.retries < config.allowedRetries[config.currentProtocol];
|
|
243
248
|
}
|
|
244
249
|
function switchProtocol(protocol) {
|
|
245
250
|
// sdkParams.protocol = current.toLowerCase();
|
|
@@ -256,7 +261,7 @@ function Chat(params) {
|
|
|
256
261
|
config.failOverProtocol = current;
|
|
257
262
|
}
|
|
258
263
|
|
|
259
|
-
console.log("
|
|
264
|
+
sdkParams.consoleLogging && console.log("[SDK]|/| switchProtocol: ", "config.currentProtocol: ", config.currentProtocol, "config.currentWaitTime: ", config.currentWaitTime)
|
|
260
265
|
|
|
261
266
|
chatEvents.fireEvent("autoSwitchAsyncProtocol", {
|
|
262
267
|
current: config.currentProtocol,
|
|
@@ -264,6 +269,7 @@ function Chat(params) {
|
|
|
264
269
|
});
|
|
265
270
|
|
|
266
271
|
resetRetries();
|
|
272
|
+
config.reconnectAsyncRequest = false;
|
|
267
273
|
initAsync();
|
|
268
274
|
});
|
|
269
275
|
|
|
@@ -274,7 +280,7 @@ function Chat(params) {
|
|
|
274
280
|
config.retries = 0;
|
|
275
281
|
}
|
|
276
282
|
|
|
277
|
-
|
|
283
|
+
const publics = {
|
|
278
284
|
switchProtocol(protocol) {
|
|
279
285
|
if(protocol == 'auto'){
|
|
280
286
|
config.switchingEnabled = true;
|
|
@@ -296,12 +302,43 @@ function Chat(params) {
|
|
|
296
302
|
resetRetries(){
|
|
297
303
|
resetRetries();
|
|
298
304
|
},
|
|
299
|
-
|
|
305
|
+
onAsyncIsReconnecting(event) {
|
|
306
|
+
sdkParams.consoleLogging && console.log("[SDK]|/| onAsyncIsReconnecting: ", "config.currentProtocol: ", config.currentProtocol, "config.currentWaitTime: ", config.currentWaitTime);
|
|
307
|
+
publics.increaseRetries();
|
|
308
|
+
|
|
309
|
+
if(config.currentWaitTime < 64) {
|
|
310
|
+
config.currentWaitTime += 3;
|
|
311
|
+
}
|
|
312
|
+
//config.currentWaitTime = event.nextTime
|
|
300
313
|
if(!canRetry() && config.switchingEnabled) {
|
|
301
314
|
switchProtocol();
|
|
302
315
|
}
|
|
316
|
+
},
|
|
317
|
+
getRetryStepTimerTime() {
|
|
318
|
+
if(config.switchingEnabled)
|
|
319
|
+
return config.currentWaitTime;
|
|
320
|
+
else return 4;
|
|
321
|
+
},
|
|
322
|
+
reconnectAsync() {
|
|
323
|
+
config.reconnectAsyncRequest = true;
|
|
324
|
+
config.currentWaitTime = 0;
|
|
325
|
+
if(config.switchingEnabled) {
|
|
326
|
+
if(!canRetry()) {
|
|
327
|
+
switchProtocol();
|
|
328
|
+
} else {
|
|
329
|
+
switchProtocol(config.currentProtocol);
|
|
330
|
+
}
|
|
331
|
+
} else {
|
|
332
|
+
if(!canRetry()) {
|
|
333
|
+
switchProtocol();
|
|
334
|
+
} else {
|
|
335
|
+
switchProtocol(config.currentProtocol);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
303
338
|
}
|
|
304
339
|
};
|
|
340
|
+
|
|
341
|
+
return publics;
|
|
305
342
|
}
|
|
306
343
|
|
|
307
344
|
|
|
@@ -365,7 +402,9 @@ function Chat(params) {
|
|
|
365
402
|
reconnectOnClose: sdkParams.reconnectOnClose,
|
|
366
403
|
asyncLogging: sdkParams.asyncLogging,
|
|
367
404
|
logLevel: (sdkParams.consoleLogging ? 3 : 1),
|
|
368
|
-
webrtcConfig: sdkParams.webrtcConfig
|
|
405
|
+
webrtcConfig: sdkParams.webrtcConfig,
|
|
406
|
+
retryStepTimerTime: protocolManager.getRetryStepTimerTime(),
|
|
407
|
+
onStartWithRetryStepGreaterThanZero: onStateChange
|
|
369
408
|
});
|
|
370
409
|
callModule.asyncInitialized(asyncClient);
|
|
371
410
|
chatMessaging.asyncInitialized(asyncClient);
|
|
@@ -404,7 +443,8 @@ function Chat(params) {
|
|
|
404
443
|
//shouldReconnectCall();
|
|
405
444
|
});
|
|
406
445
|
|
|
407
|
-
asyncClient.on('stateChange',
|
|
446
|
+
asyncClient.on('stateChange', onStateChange);
|
|
447
|
+
function onStateChange(state) {
|
|
408
448
|
chatEvents.fireEvent('chatState', state);
|
|
409
449
|
chatFullStateObject = state;
|
|
410
450
|
|
|
@@ -432,7 +472,7 @@ function Chat(params) {
|
|
|
432
472
|
//chatMessaging.sendPingTimeout && clearTimeout(chatMessaging.sendPingTimeout);
|
|
433
473
|
break;
|
|
434
474
|
}
|
|
435
|
-
}
|
|
475
|
+
}
|
|
436
476
|
|
|
437
477
|
asyncClient.on('connect', function (newPeerId) {
|
|
438
478
|
asyncGetReadyTime = new Date().getTime();
|
|
@@ -459,10 +499,9 @@ function Chat(params) {
|
|
|
459
499
|
chatEvents.fireEvent('reconnect');
|
|
460
500
|
});
|
|
461
501
|
|
|
462
|
-
asyncClient.on('reconnecting', function () {
|
|
502
|
+
asyncClient.on('reconnecting', function (event) {
|
|
463
503
|
sdkParams.consoleLogging && console.log("[SDK][event: asyncClient.reconnecting]")
|
|
464
|
-
protocolManager.
|
|
465
|
-
protocolManager.maybeSwitchProtocol();
|
|
504
|
+
protocolManager.onAsyncIsReconnecting(event);
|
|
466
505
|
});
|
|
467
506
|
|
|
468
507
|
|
|
@@ -11630,7 +11669,7 @@ function Chat(params) {
|
|
|
11630
11669
|
};
|
|
11631
11670
|
|
|
11632
11671
|
publicized.reconnect = function () {
|
|
11633
|
-
|
|
11672
|
+
protocolManager.reconnectAsync();
|
|
11634
11673
|
};
|
|
11635
11674
|
|
|
11636
11675
|
publicized.setToken = function (newToken) {
|
package/src/messaging.module.js
CHANGED
|
@@ -36,6 +36,7 @@ import {sdkParams} from "./lib/sdkParams";
|
|
|
36
36
|
* TODO: remove the interval when socket statet changes to closed
|
|
37
37
|
*/
|
|
38
38
|
this.startChatPing = function () {
|
|
39
|
+
sdkParams.chatPingMessageInterval && clearInterval(sdkParams.chatPingMessageInterval);
|
|
39
40
|
sdkParams.chatPingMessageInterval = setInterval(() => {
|
|
40
41
|
currentModuleInstance.ping();
|
|
41
42
|
}, 20000) ;//TODO: chatPingMessageInterval
|