quickblox 2.17.9-logger → 2.17.10-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/package.json +1 -1
- package/quickblox.js +62 -61
- package/quickblox.min.js +1 -1
- package/src/modules/chat/qbChat.js +12 -2
- package/src/qbConfig.js +1 -1
- package/src/qbStrophe.js +48 -57
|
@@ -1221,6 +1221,11 @@ ChatProxy.prototype = {
|
|
|
1221
1221
|
|
|
1222
1222
|
reconnect: function () {
|
|
1223
1223
|
Utils.QBLog('[QBChat]', 'Call reconnect ');
|
|
1224
|
+
if (typeof this.onLogListener === 'function') {
|
|
1225
|
+
Utils.safeCallbackCall(this.onLogListener,
|
|
1226
|
+
'[QBChat]' +'[SDK v'+config.version+']' + ' Call reconnect ' +
|
|
1227
|
+
chatUtils.getLocalTime());
|
|
1228
|
+
}
|
|
1224
1229
|
clearInterval(this._checkConnectionTimer);
|
|
1225
1230
|
this._checkConnectionTimer = undefined;
|
|
1226
1231
|
this.muc.joinedRooms = {};
|
|
@@ -1228,7 +1233,7 @@ ChatProxy.prototype = {
|
|
|
1228
1233
|
|
|
1229
1234
|
if (Utils.getEnv().browser) {
|
|
1230
1235
|
this.connection.flush();
|
|
1231
|
-
this.connection.disconnect('reconnect
|
|
1236
|
+
this.connection.disconnect('call Qb.chat.reconnect');//artik should be added reasone = 'reconnect from SDK'
|
|
1232
1237
|
} else {
|
|
1233
1238
|
this.Client.end();
|
|
1234
1239
|
}
|
|
@@ -1605,6 +1610,11 @@ ChatProxy.prototype = {
|
|
|
1605
1610
|
* */
|
|
1606
1611
|
disconnect: function () {
|
|
1607
1612
|
Utils.QBLog('[QBChat]', 'Call disconnect ');
|
|
1613
|
+
if (typeof this.onLogListener === 'function') {
|
|
1614
|
+
Utils.safeCallbackCall(this.onLogListener,
|
|
1615
|
+
'[QBChat]' +'[SDK v'+config.version+']' + ' Call disconnect ' +
|
|
1616
|
+
chatUtils.getLocalTime());
|
|
1617
|
+
}
|
|
1608
1618
|
clearInterval(this._checkConnectionTimer);
|
|
1609
1619
|
clearInterval(this._checkExpiredSessionTimer);
|
|
1610
1620
|
this._checkConnectionTimer = undefined;
|
|
@@ -1615,7 +1625,7 @@ ChatProxy.prototype = {
|
|
|
1615
1625
|
|
|
1616
1626
|
if (Utils.getEnv().browser) {
|
|
1617
1627
|
this.connection.flush();
|
|
1618
|
-
this.connection.disconnect('disconnect
|
|
1628
|
+
this.connection.disconnect('call QB.chat.disconnect');//artik should add reason = 'disconnect from SDK'
|
|
1619
1629
|
if (this._checkConnectionPingTimer !== undefined) {
|
|
1620
1630
|
Utils.QBLog('[QBChat]', 'Stop ping');
|
|
1621
1631
|
clearInterval(this._checkConnectionPingTimer);
|
package/src/qbConfig.js
CHANGED
package/src/qbStrophe.js
CHANGED
|
@@ -16,70 +16,61 @@ var Utils = require('./qbUtils');
|
|
|
16
16
|
var QBChatModules = require('./modules/chat/qbChat');
|
|
17
17
|
|
|
18
18
|
function Connection(onLogListenerCallback) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
conn.xmlInput = function(data) {
|
|
25
|
-
if (data.childNodes[0]) {
|
|
26
|
-
for (var i = 0, len = data.childNodes.length; i < len; i++) {
|
|
27
|
-
Utils.QBLog('[QBChat]', 'RECV:', data.childNodes[i]);
|
|
28
|
-
if (onLogListener && typeof onLogListener === 'function') {
|
|
29
|
-
Utils.safeCallbackCall(onLogListener,
|
|
30
|
-
'[QBChat][QBStrophe]' + 'RECV:' + data.childNodes[i]);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
conn.xmlOutput = function(data) {
|
|
36
|
-
if (data.childNodes[0]) {
|
|
37
|
-
for (var i = 0, len = data.childNodes.length; i < len; i++) {
|
|
38
|
-
Utils.QBLog('[QBChat]', 'SENT:', data.childNodes[i]);
|
|
39
|
-
if (onLogListener && typeof onLogListener === 'function') {
|
|
40
|
-
Utils.safeCallbackCall(onLogListener,
|
|
41
|
-
'[QBChat][QBStrophe]' + 'SENT:' + data.childNodes[i]);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
} else {
|
|
47
|
-
conn.xmlInput = function(data) {
|
|
48
|
-
Utils.QBLog('[QBChat]', 'RECV:', data);
|
|
19
|
+
var protocol = chatPRTCL.active === 1 ? chatPRTCL.bosh : chatPRTCL.websocket;
|
|
20
|
+
var conn = new Strophe.Connection(protocol);
|
|
21
|
+
var onLogListener = config.debug? onLogListenerCallback || QBChatModules.onLogListener : null;
|
|
22
|
+
var safeCallbackCall = function(message, data) {
|
|
23
|
+
onLogListener = onLogListenerCallback || QBChatModules.onLogListener;
|
|
49
24
|
if (onLogListener && typeof onLogListener === 'function') {
|
|
50
25
|
Utils.safeCallbackCall(onLogListener,
|
|
51
|
-
'[QBChat][QBStrophe]' +
|
|
26
|
+
'[QBChat][QBStrophe]' + message + data);
|
|
52
27
|
}
|
|
53
|
-
|
|
54
|
-
let parser = new DOMParser();
|
|
55
|
-
let xmlDoc = parser.parseFromString(data, 'text/xml');
|
|
28
|
+
};
|
|
56
29
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (onLogListener && typeof onLogListener === 'function') {
|
|
64
|
-
Utils.safeCallbackCall(onLogListener,
|
|
65
|
-
'[QBChat][QBStrophe]' + 'DISCONNECTED CONDITION: ' + disconnectCondition);
|
|
66
|
-
}
|
|
30
|
+
if (chatPRTCL.active === 1) {
|
|
31
|
+
conn.xmlInput = function(data) {
|
|
32
|
+
if (data.childNodes[0]) {
|
|
33
|
+
for (var i = 0, len = data.childNodes.length; i < len; i++) {
|
|
34
|
+
Utils.QBLog('[QBChat]', 'RECV:', data.childNodes[i]);
|
|
35
|
+
safeCallbackCall('RECV:', data.childNodes[i]);
|
|
67
36
|
}
|
|
68
37
|
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
38
|
+
};
|
|
39
|
+
conn.xmlOutput = function(data) {
|
|
40
|
+
if (data.childNodes[0]) {
|
|
41
|
+
for (var i = 0, len = data.childNodes.length; i < len; i++) {
|
|
42
|
+
Utils.QBLog('[QBChat]', 'SENT:', data.childNodes[i]);
|
|
43
|
+
safeCallbackCall('SENT', data.childNodes[i]);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
} else {
|
|
48
|
+
conn.xmlInput = function(data) {
|
|
49
|
+
Utils.QBLog('[QBChat]', 'RECV:', data);
|
|
50
|
+
safeCallbackCall('RECV:', data);
|
|
81
51
|
|
|
82
|
-
|
|
52
|
+
try {
|
|
53
|
+
let parser = new DOMParser();
|
|
54
|
+
let xmlDoc = parser.parseFromString(data, 'text/xml');
|
|
55
|
+
let errorElem = xmlDoc.getElementsByTagName('error');
|
|
56
|
+
if (errorElem.length > 0) {
|
|
57
|
+
let conditionElem = errorElem[0].getElementsByTagName('condition');
|
|
58
|
+
if (conditionElem.length > 0) {
|
|
59
|
+
let disconnectCondition = conditionElem[0].textContent;
|
|
60
|
+
console.log('Disconnect condition:', disconnectCondition);
|
|
61
|
+
safeCallbackCall('DISCONNECTED CONDITION:', disconnectCondition);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
} catch (e) {
|
|
65
|
+
console.error('Error parsing XML input:', e);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
conn.xmlOutput = function(data) {
|
|
69
|
+
Utils.QBLog('[QBChat]', 'SENT:', data);
|
|
70
|
+
safeCallbackCall('SENT', data);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return conn;
|
|
83
74
|
}
|
|
84
75
|
|
|
85
76
|
module.exports = Connection;
|