quickblox 2.17.1 → 2.17.2-beta.2-logger
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/README.md +1 -1
- package/package.json +1 -1
- package/quickblox.d.ts +1 -0
- package/quickblox.js +76 -7
- package/quickblox.min.js +1 -1
- package/src/modules/chat/qbChat.js +47 -4
- package/src/qbConfig.js +2 -2
- package/src/qbStrophe.js +27 -1
package/README.md
CHANGED
package/package.json
CHANGED
package/quickblox.d.ts
CHANGED
|
@@ -523,6 +523,7 @@ interface QBChatModule {
|
|
|
523
523
|
onReconnectListener?: () => void
|
|
524
524
|
onReconnectFailedListener?: (error: any) => void
|
|
525
525
|
onSessionExpiredListener?: (error?: QBError) => void
|
|
526
|
+
onLogListener?: (logLine: string) => void
|
|
526
527
|
/**
|
|
527
528
|
* Receive reject request
|
|
528
529
|
* ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#reject-the-contact-request)).
|
package/quickblox.js
CHANGED
|
@@ -45463,7 +45463,7 @@ function ChatProxy(service) {
|
|
|
45463
45463
|
*/
|
|
45464
45464
|
if (Utils.getEnv().browser) {
|
|
45465
45465
|
// strophe js
|
|
45466
|
-
self.connection = Connection();
|
|
45466
|
+
self.connection = Connection(self.onLogListener);
|
|
45467
45467
|
|
|
45468
45468
|
/** Add extension methods to track handlers for removal on reconnect */
|
|
45469
45469
|
self.connection.XHandlerReferences = [];
|
|
@@ -45579,6 +45579,7 @@ function ChatProxy(service) {
|
|
|
45579
45579
|
* - onDisconnectedListener
|
|
45580
45580
|
* - onReconnectListener
|
|
45581
45581
|
* - onSessionExpiredListener
|
|
45582
|
+
* - onLogListener
|
|
45582
45583
|
*/
|
|
45583
45584
|
|
|
45584
45585
|
/**
|
|
@@ -45712,6 +45713,12 @@ function ChatProxy(service) {
|
|
|
45712
45713
|
* @memberOf QB.chat
|
|
45713
45714
|
**/
|
|
45714
45715
|
|
|
45716
|
+
/**
|
|
45717
|
+
* Run after disconnect from chat to log result
|
|
45718
|
+
* @function onLogListener
|
|
45719
|
+
* @memberOf QB.chat
|
|
45720
|
+
**/
|
|
45721
|
+
|
|
45715
45722
|
|
|
45716
45723
|
this._onMessage = function (stanza) {
|
|
45717
45724
|
var from = chatUtils.getAttr(stanza, 'from'),
|
|
@@ -46168,7 +46175,7 @@ ChatProxy.prototype = {
|
|
|
46168
46175
|
/** Connect for browser env. */
|
|
46169
46176
|
if (Utils.getEnv().browser) {
|
|
46170
46177
|
Utils.QBLog('[QBChat]', '!!---Browser env - connected--!!');
|
|
46171
|
-
|
|
46178
|
+
let disconnectCondition = '';
|
|
46172
46179
|
self.connection.connect(userJid, params.password, function (status) {
|
|
46173
46180
|
Utils.QBLog('[QBChat]', 'self.connection.connect called with status ' + status);
|
|
46174
46181
|
switch (status) {
|
|
@@ -46297,7 +46304,14 @@ ChatProxy.prototype = {
|
|
|
46297
46304
|
break;
|
|
46298
46305
|
case Strophe.Status.DISCONNECTED:
|
|
46299
46306
|
Utils.QBLog('[QBChat]', 'Status.DISCONNECTED at ' + chatUtils.getLocalTime());
|
|
46300
|
-
|
|
46307
|
+
//
|
|
46308
|
+
Utils.QBLog('[QBChat]', 'DISCONNECTED CONDITION: ' + disconnectCondition);
|
|
46309
|
+
//
|
|
46310
|
+
if (typeof self.onLogListener === 'function') {
|
|
46311
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
46312
|
+
'[QBChat]' + ' Status.DISCONNECTED at ' +
|
|
46313
|
+
chatUtils.getLocalTime()+ ' DISCONNECTED CONDITION: ' + disconnectCondition);
|
|
46314
|
+
}
|
|
46301
46315
|
// fire 'onDisconnectedListener' only once
|
|
46302
46316
|
if (self.isConnected && typeof self.onDisconnectedListener === 'function') {
|
|
46303
46317
|
Utils.safeCallbackCall(self.onDisconnectedListener);
|
|
@@ -46455,20 +46469,45 @@ ChatProxy.prototype = {
|
|
|
46455
46469
|
_establishConnection: function (params) {
|
|
46456
46470
|
var self = this;
|
|
46457
46471
|
Utils.QBLog('[QBChat]', '_establishConnection called');
|
|
46472
|
+
if (typeof self.onLogListener === 'function') {
|
|
46473
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
46474
|
+
'[QBChat]' + '_establishConnection called');
|
|
46475
|
+
}
|
|
46458
46476
|
if (self._isLogout || self._checkConnectionTimer) {
|
|
46459
46477
|
Utils.QBLog('[QBChat]', '_establishConnection return');
|
|
46478
|
+
if (typeof self.onLogListener === 'function') {
|
|
46479
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
46480
|
+
'[QBChat]' + ' _establishConnection return with self._isLogout: '+
|
|
46481
|
+
self._isLogout+' and self._checkConnectionTimer ' +self._checkConnectionTimer?'set up':'undefined');
|
|
46482
|
+
}
|
|
46460
46483
|
return;
|
|
46461
46484
|
}
|
|
46462
46485
|
|
|
46463
46486
|
var _connect = function () {
|
|
46464
46487
|
Utils.QBLog('[QBChat]', 'call _connect() in _establishConnection ');
|
|
46488
|
+
if (typeof self.onLogListener === 'function') {
|
|
46489
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
46490
|
+
'[QBChat]' + ' call _connect() in _establishConnection ');
|
|
46491
|
+
}
|
|
46465
46492
|
if (!self.isConnected && !self._isConnecting && !self._sessionHasExpired) {
|
|
46466
|
-
Utils.QBLog('[QBChat]', '
|
|
46493
|
+
Utils.QBLog('[QBChat]', ' start execute connect() in _establishConnection ');
|
|
46494
|
+
if (typeof self.onLogListener === 'function') {
|
|
46495
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
46496
|
+
'[QBChat]' + ' with statuses (!self.isConnected && !self._isConnecting && !self._sessionHasExpired): '+' self.isConnected: '+self.isConnected+' self._isConnecting: '+self._isConnecting+' self._sessionHasExpired: '+self._sessionHasExpired);
|
|
46497
|
+
}
|
|
46467
46498
|
self.connect(params);
|
|
46499
|
+
if (typeof self.onLogListener === 'function') {
|
|
46500
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
46501
|
+
'[QBChat]' + 'call _connect() in _establishConnection is executed');
|
|
46502
|
+
}
|
|
46468
46503
|
} else {
|
|
46469
46504
|
Utils.QBLog('[QBChat]', 'stop timer in _establishConnection ');
|
|
46470
46505
|
clearInterval(self._checkConnectionTimer);
|
|
46471
46506
|
self._checkConnectionTimer = undefined;
|
|
46507
|
+
if (typeof self.onLogListener === 'function') {
|
|
46508
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
46509
|
+
'[QBChat]' + 'stop timer in _establishConnection ');
|
|
46510
|
+
}
|
|
46472
46511
|
}
|
|
46473
46512
|
};
|
|
46474
46513
|
|
|
@@ -46476,6 +46515,10 @@ ChatProxy.prototype = {
|
|
|
46476
46515
|
|
|
46477
46516
|
self._checkConnectionTimer = setInterval(function () {
|
|
46478
46517
|
Utils.QBLog('[QBChat]', 'self._checkConnectionTimer called with config.chatReconnectionTimeInterval = ' + config.chatReconnectionTimeInterval);
|
|
46518
|
+
if (typeof self.onLogListener === 'function') {
|
|
46519
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
46520
|
+
'[QBChat]' + 'self._checkConnectionTimer called with config.chatReconnectionTimeInterval = ' + config.chatReconnectionTimeInterval);
|
|
46521
|
+
}
|
|
46479
46522
|
_connect();
|
|
46480
46523
|
}, config.chatReconnectionTimeInterval * 1000);
|
|
46481
46524
|
},
|
|
@@ -53809,8 +53852,8 @@ module.exports = StreamManagement;
|
|
|
53809
53852
|
*/
|
|
53810
53853
|
|
|
53811
53854
|
var config = {
|
|
53812
|
-
version: '2.17.
|
|
53813
|
-
buildNumber: '
|
|
53855
|
+
version: '2.17.2-beta.2-logger',
|
|
53856
|
+
buildNumber: '1162',
|
|
53814
53857
|
creds: {
|
|
53815
53858
|
'appId': 0,
|
|
53816
53859
|
'authKey': '',
|
|
@@ -54522,7 +54565,7 @@ var config = require('./qbConfig');
|
|
|
54522
54565
|
var chatPRTCL = config.chatProtocol;
|
|
54523
54566
|
var Utils = require('./qbUtils');
|
|
54524
54567
|
|
|
54525
|
-
function Connection() {
|
|
54568
|
+
function Connection(onLogListener) {
|
|
54526
54569
|
var protocol = chatPRTCL.active === 1 ? chatPRTCL.bosh : chatPRTCL.websocket;
|
|
54527
54570
|
var conn = new Strophe.Connection(protocol);
|
|
54528
54571
|
|
|
@@ -54544,6 +54587,32 @@ function Connection() {
|
|
|
54544
54587
|
} else {
|
|
54545
54588
|
conn.xmlInput = function(data) {
|
|
54546
54589
|
Utils.QBLog('[QBChat]', 'RECV:', data);
|
|
54590
|
+
//
|
|
54591
|
+
if (onLogListener && typeof onLogListener === 'function') {
|
|
54592
|
+
Utils.safeCallbackCall(onLogListener,
|
|
54593
|
+
'[QBChat][QBStrophe]' + 'RECV: ' + data);
|
|
54594
|
+
}
|
|
54595
|
+
//
|
|
54596
|
+
try {
|
|
54597
|
+
let parser = new DOMParser();
|
|
54598
|
+
let xmlDoc = parser.parseFromString(data, 'text/xml');
|
|
54599
|
+
|
|
54600
|
+
let errorElem = xmlDoc.getElementsByTagName('error');
|
|
54601
|
+
if (errorElem.length > 0) {
|
|
54602
|
+
let conditionElem = errorElem[0].getElementsByTagName('condition');
|
|
54603
|
+
if (conditionElem.length > 0) {
|
|
54604
|
+
let disconnectCondition = conditionElem[0].textContent;
|
|
54605
|
+
console.log('Disconnect condition:', disconnectCondition);
|
|
54606
|
+
if (onLogListener && typeof onLogListener === 'function') {
|
|
54607
|
+
Utils.safeCallbackCall(onLogListener,
|
|
54608
|
+
'[QBChat][QBStrophe]' + 'DISCONNECTED CONDITION: ' + disconnectCondition);
|
|
54609
|
+
}
|
|
54610
|
+
}
|
|
54611
|
+
}
|
|
54612
|
+
} catch (e) {
|
|
54613
|
+
console.error('Error parsing XML input:', e);
|
|
54614
|
+
}
|
|
54615
|
+
//
|
|
54547
54616
|
};
|
|
54548
54617
|
conn.xmlOutput = function(data) {
|
|
54549
54618
|
Utils.QBLog('[QBChat]', 'SENT:', data);
|