quickblox 2.19.0 → 2.19.2
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/{LICENSE → LICENSE.md} +35 -49
- package/README.md +3 -1
- package/package.json +2 -2
- package/quickblox.d.ts +3 -0
- package/quickblox.js +37367 -26454
- package/quickblox.min.js +1 -1
- package/src/modules/chat/qbChat.js +35 -18
- package/src/qbConfig.js +2 -2
- package/src/qbStrophe.js +6 -4
- package/strophejs-1.4.0/dist/strophe.common.js +0 -6668
- package/strophejs-1.4.0/dist/strophe.esm.js +0 -6660
- package/strophejs-1.4.0/dist/strophe.umd.js +0 -6873
- package/strophejs-1.4.0/dist/strophe.umd.min.js +0 -1
|
@@ -39,7 +39,7 @@ function ChatProxy(service) {
|
|
|
39
39
|
*/
|
|
40
40
|
if (Utils.getEnv().browser) {
|
|
41
41
|
// strophe js
|
|
42
|
-
self.connection = Connection(self.
|
|
42
|
+
self.connection = Connection(self._OnLogListener.bind(this));
|
|
43
43
|
|
|
44
44
|
/** Add extension methods to track handlers for removal on reconnect */
|
|
45
45
|
self.connection.XHandlerReferences = [];
|
|
@@ -295,7 +295,6 @@ function ChatProxy(service) {
|
|
|
295
295
|
* @memberOf QB.chat
|
|
296
296
|
**/
|
|
297
297
|
|
|
298
|
-
|
|
299
298
|
this._onMessage = function (stanza) {
|
|
300
299
|
var from = chatUtils.getAttr(stanza, 'from'),
|
|
301
300
|
to = chatUtils.getAttr(stanza, 'to'),
|
|
@@ -418,12 +417,12 @@ function ChatProxy(service) {
|
|
|
418
417
|
}
|
|
419
418
|
|
|
420
419
|
// MUC presences go here
|
|
421
|
-
if (xXMLNS && xXMLNS ==
|
|
420
|
+
if (xXMLNS && xXMLNS == 'http://jabber.org/protocol/muc#user') {
|
|
422
421
|
dialogId = self.helpers.getDialogIdFromNode(from);
|
|
423
422
|
userId = self.helpers.getUserIdFromRoomJid(from);
|
|
424
423
|
|
|
425
424
|
// KICK from dialog event
|
|
426
|
-
if (status && statusCode ==
|
|
425
|
+
if (status && statusCode == '301') {
|
|
427
426
|
if (typeof self.onKickOccupant === 'function') {
|
|
428
427
|
var actorElement = chatUtils.getElement(chatUtils.getElement(x, 'item'), 'actor');
|
|
429
428
|
var initiatorUserJid = chatUtils.getAttr(actorElement, 'jid');
|
|
@@ -701,6 +700,13 @@ function ChatProxy(service) {
|
|
|
701
700
|
----------------------------------------------------------------------------- */
|
|
702
701
|
ChatProxy.prototype = {
|
|
703
702
|
|
|
703
|
+
_OnLogListener: function (message) {
|
|
704
|
+
var self = this;
|
|
705
|
+
if (typeof self.onLogListener === 'function') {
|
|
706
|
+
Utils.safeCallbackCall(self.onLogListener, message);
|
|
707
|
+
}
|
|
708
|
+
},
|
|
709
|
+
|
|
704
710
|
/**
|
|
705
711
|
* self.connection to the chat. {@link https://quickblox.com/developers/Web_XMPP_Chat_Sample#Login_to_Chat More info.}
|
|
706
712
|
* @memberof QB.chat
|
|
@@ -751,6 +757,7 @@ ChatProxy.prototype = {
|
|
|
751
757
|
/** Connect for browser env. */
|
|
752
758
|
if (Utils.getEnv().browser) {
|
|
753
759
|
Utils.QBLog('[QBChat]', '!!---Browser env - connected--!!');
|
|
760
|
+
|
|
754
761
|
self.connection.connect(userJid, params.password, function (status, condition, elem) {
|
|
755
762
|
Utils.QBLog('[QBChat]', 'self.connection.connect called with status ' + status);
|
|
756
763
|
Utils.QBLog('[QBChat]', 'self.connection.connect called with condition ' + condition);
|
|
@@ -1070,7 +1077,7 @@ ChatProxy.prototype = {
|
|
|
1070
1077
|
self._isConnecting = false;
|
|
1071
1078
|
|
|
1072
1079
|
// reconnect to chat and enable check connection
|
|
1073
|
-
self._establishConnection(params);
|
|
1080
|
+
self._establishConnection(params,'NODE:DISCONNECTED');
|
|
1074
1081
|
});
|
|
1075
1082
|
|
|
1076
1083
|
self.Client.on('error', function () {
|
|
@@ -1152,39 +1159,39 @@ ChatProxy.prototype = {
|
|
|
1152
1159
|
}
|
|
1153
1160
|
},
|
|
1154
1161
|
|
|
1155
|
-
_establishConnection: function (params) {
|
|
1162
|
+
_establishConnection: function (params, description) {
|
|
1156
1163
|
var self = this;
|
|
1157
|
-
Utils.QBLog('[QBChat]', '_establishConnection called');
|
|
1164
|
+
Utils.QBLog('[QBChat]', '_establishConnection called in ' + description);
|
|
1158
1165
|
if (typeof self.onLogListener === 'function') {
|
|
1159
1166
|
Utils.safeCallbackCall(self.onLogListener,
|
|
1160
|
-
'[QBChat]' + '_establishConnection called');
|
|
1167
|
+
'[QBChat]' + '_establishConnection called in ' + description);
|
|
1161
1168
|
}
|
|
1162
1169
|
if (self._isLogout || self._checkConnectionTimer) {
|
|
1163
1170
|
Utils.QBLog('[QBChat]', '_establishConnection return');
|
|
1164
1171
|
if (typeof self.onLogListener === 'function') {
|
|
1165
1172
|
Utils.safeCallbackCall(self.onLogListener,
|
|
1166
|
-
'[QBChat]' + ' _establishConnection
|
|
1167
|
-
self._isLogout+' and self._checkConnectionTimer ' +self._checkConnectionTimer?
|
|
1173
|
+
'[QBChat]' + 'BREAK _establishConnection RETURN with self._isLogout: '+
|
|
1174
|
+
self._isLogout?self._isLogout:'undefined'+' and self._checkConnectionTimer ' +self._checkConnectionTimer?self._checkConnectionTimer:'undefined');
|
|
1168
1175
|
}
|
|
1169
1176
|
return;
|
|
1170
1177
|
}
|
|
1171
1178
|
|
|
1172
1179
|
var _connect = function () {
|
|
1173
|
-
Utils.QBLog('[QBChat]', 'call _connect() in _establishConnection ');
|
|
1180
|
+
Utils.QBLog('[QBChat]', 'call _connect() in _establishConnection in '+description);
|
|
1174
1181
|
if (typeof self.onLogListener === 'function') {
|
|
1175
1182
|
Utils.safeCallbackCall(self.onLogListener,
|
|
1176
|
-
'[QBChat]' + ' call _connect() in _establishConnection ');
|
|
1183
|
+
'[QBChat]' + ' call _connect() in _establishConnection in '+description);
|
|
1177
1184
|
}
|
|
1178
1185
|
if (!self.isConnected && !self._isConnecting && !self._sessionHasExpired) {
|
|
1179
|
-
Utils.QBLog('[QBChat]', ' start
|
|
1186
|
+
Utils.QBLog('[QBChat]', ' start EXECUTE connect() in _establishConnection ');
|
|
1180
1187
|
if (typeof self.onLogListener === 'function') {
|
|
1181
1188
|
Utils.safeCallbackCall(self.onLogListener,
|
|
1182
|
-
'[QBChat]' + '
|
|
1189
|
+
'[QBChat]' + ' start EXECUTE connect() in _establishConnection in '+description+' self.isConnected: '+self.isConnected+' self._isConnecting: '+self._isConnecting+' self._sessionHasExpired: '+self._sessionHasExpired);
|
|
1183
1190
|
}
|
|
1184
1191
|
self.connect(params);
|
|
1185
1192
|
if (typeof self.onLogListener === 'function') {
|
|
1186
1193
|
Utils.safeCallbackCall(self.onLogListener,
|
|
1187
|
-
'[QBChat]' + 'call _connect() in _establishConnection is executed');
|
|
1194
|
+
'[QBChat]' + 'call _connect() in _establishConnection in '+description+' is executed');
|
|
1188
1195
|
}
|
|
1189
1196
|
} else {
|
|
1190
1197
|
Utils.QBLog('[QBChat]', 'stop timer in _establishConnection ');
|
|
@@ -1192,7 +1199,7 @@ ChatProxy.prototype = {
|
|
|
1192
1199
|
self._checkConnectionTimer = undefined;
|
|
1193
1200
|
if (typeof self.onLogListener === 'function') {
|
|
1194
1201
|
Utils.safeCallbackCall(self.onLogListener,
|
|
1195
|
-
'[QBChat]' + 'stop timer in _establishConnection ');
|
|
1202
|
+
'[QBChat]' + 'stop timer in _establishConnection in '+description);
|
|
1196
1203
|
}
|
|
1197
1204
|
}
|
|
1198
1205
|
};
|
|
@@ -1211,6 +1218,11 @@ ChatProxy.prototype = {
|
|
|
1211
1218
|
|
|
1212
1219
|
reconnect: function () {
|
|
1213
1220
|
Utils.QBLog('[QBChat]', 'Call reconnect ');
|
|
1221
|
+
if (typeof this.onLogListener === 'function') {
|
|
1222
|
+
Utils.safeCallbackCall(this.onLogListener,
|
|
1223
|
+
'[QBChat]' +'[SDK v'+config.version+']' + ' Call reconnect ' +
|
|
1224
|
+
chatUtils.getLocalTime());
|
|
1225
|
+
}
|
|
1214
1226
|
clearInterval(this._checkConnectionTimer);
|
|
1215
1227
|
this._checkConnectionTimer = undefined;
|
|
1216
1228
|
this.muc.joinedRooms = {};
|
|
@@ -1218,7 +1230,7 @@ ChatProxy.prototype = {
|
|
|
1218
1230
|
|
|
1219
1231
|
if (Utils.getEnv().browser) {
|
|
1220
1232
|
this.connection.flush();
|
|
1221
|
-
this.connection.disconnect()
|
|
1233
|
+
this.connection.disconnect('call Qb.chat.reconnect');//artik should be added reasone = 'reconnect from SDK'
|
|
1222
1234
|
} else {
|
|
1223
1235
|
this.Client.end();
|
|
1224
1236
|
}
|
|
@@ -1595,6 +1607,11 @@ ChatProxy.prototype = {
|
|
|
1595
1607
|
* */
|
|
1596
1608
|
disconnect: function () {
|
|
1597
1609
|
Utils.QBLog('[QBChat]', 'Call disconnect ');
|
|
1610
|
+
if (typeof this.onLogListener === 'function') {
|
|
1611
|
+
Utils.safeCallbackCall(this.onLogListener,
|
|
1612
|
+
'[QBChat]' +'[SDK v'+config.version+']' + ' Call disconnect ' +
|
|
1613
|
+
chatUtils.getLocalTime());
|
|
1614
|
+
}
|
|
1598
1615
|
clearInterval(this._checkConnectionTimer);
|
|
1599
1616
|
clearInterval(this._checkExpiredSessionTimer);
|
|
1600
1617
|
this._checkConnectionTimer = undefined;
|
|
@@ -1605,7 +1622,7 @@ ChatProxy.prototype = {
|
|
|
1605
1622
|
|
|
1606
1623
|
if (Utils.getEnv().browser) {
|
|
1607
1624
|
this.connection.flush();
|
|
1608
|
-
this.connection.disconnect()
|
|
1625
|
+
this.connection.disconnect('call QB.chat.disconnect');//artik should add reason = 'disconnect from SDK'
|
|
1609
1626
|
if (this._checkConnectionPingTimer !== undefined) {
|
|
1610
1627
|
Utils.QBLog('[QBChat]', 'Stop ping');
|
|
1611
1628
|
clearInterval(this._checkConnectionPingTimer);
|
package/src/qbConfig.js
CHANGED
package/src/qbStrophe.js
CHANGED
|
@@ -12,17 +12,19 @@ require('strophe.js');
|
|
|
12
12
|
var config = require('./qbConfig');
|
|
13
13
|
var chatPRTCL = config.chatProtocol;
|
|
14
14
|
var Utils = require('./qbUtils');
|
|
15
|
-
var QBChatModules = require('./modules/chat/qbChat');
|
|
16
15
|
|
|
17
16
|
function Connection(onLogListenerCallback) {
|
|
18
17
|
var protocol = chatPRTCL.active === 1 ? chatPRTCL.bosh : chatPRTCL.websocket;
|
|
19
18
|
var conn = new Strophe.Connection(protocol);
|
|
20
|
-
var onLogListener = config.debug? onLogListenerCallback
|
|
19
|
+
var onLogListener = config.debug ? onLogListenerCallback : null;
|
|
21
20
|
var safeCallbackCall = function(message, data) {
|
|
22
|
-
onLogListener =
|
|
21
|
+
onLogListener = config.debug ? onLogListenerCallback : null;
|
|
23
22
|
if (onLogListener && typeof onLogListener === 'function') {
|
|
23
|
+
var id = data && data.id? data.id : '';
|
|
24
|
+
var innerHTML = data && data.innerHTML? data.innerHTML : '';
|
|
25
|
+
var outerHTML = data && data.outerHTML? data.outerHTML : '';
|
|
24
26
|
Utils.safeCallbackCall(onLogListener,
|
|
25
|
-
'[QBChat][QBStrophe]' + message + data);
|
|
27
|
+
'[QBChat][QBStrophe]' + message + ' id:'+id+' innerHTML: '+innerHTML+' outerHTML: '+outerHTML+JSON.stringify(data));
|
|
26
28
|
}
|
|
27
29
|
};
|
|
28
30
|
|