quickblox 2.17.2-beta.2-logger → 2.18.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.
- package/LICENSE +330 -201
- package/README.md +2 -2
- package/package.json +1 -1
- package/quickblox.js +24 -7
- package/quickblox.min.js +1 -1
- package/src/modules/chat/qbChat.js +22 -0
- package/src/qbConfig.js +1 -1
- package/src/qbProxy.js +1 -1
- package/src/qbStrophe.js +0 -5
|
@@ -906,6 +906,28 @@ ChatProxy.prototype = {
|
|
|
906
906
|
break;
|
|
907
907
|
}
|
|
908
908
|
});
|
|
909
|
+
// connection error handler
|
|
910
|
+
self.connection.xmlInput = function (data) {
|
|
911
|
+
try {
|
|
912
|
+
let parser = new DOMParser();
|
|
913
|
+
let xmlDoc = parser.parseFromString(data, 'text/xml');
|
|
914
|
+
|
|
915
|
+
let errorElem = xmlDoc.getElementsByTagName('error');
|
|
916
|
+
if (errorElem.length > 0) {
|
|
917
|
+
let conditionElem = errorElem[0].getElementsByTagName('condition');
|
|
918
|
+
if (conditionElem.length > 0) {
|
|
919
|
+
disconnectCondition = conditionElem[0].textContent;
|
|
920
|
+
console.log('Disconnect condition:', disconnectCondition);
|
|
921
|
+
if (typeof self.onLogListener === 'function') {
|
|
922
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
923
|
+
'[QBChat]' + ' DISCONNECTED CONDITION: ' + disconnectCondition);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
} catch (e) {
|
|
928
|
+
console.error('Error parsing XML input:', e);
|
|
929
|
+
}
|
|
930
|
+
};
|
|
909
931
|
}
|
|
910
932
|
|
|
911
933
|
/** connect for node */
|
package/src/qbConfig.js
CHANGED
package/src/qbProxy.js
CHANGED
|
@@ -42,7 +42,7 @@ ServiceProxy.prototype = {
|
|
|
42
42
|
handleResponse: function(error, response, next, retry) {
|
|
43
43
|
// can add middleware here...
|
|
44
44
|
if (error) {
|
|
45
|
-
const errorMsg = JSON.stringify(error.message).toLowerCase();
|
|
45
|
+
const errorMsg = error.message ? JSON.stringify(error.message).toLowerCase() : '';
|
|
46
46
|
if (typeof config.on.sessionExpired === 'function' &&
|
|
47
47
|
error.code === 401 &&
|
|
48
48
|
errorMsg.indexOf('session does not exist') > -1) {
|
package/src/qbStrophe.js
CHANGED
|
@@ -35,11 +35,6 @@ function Connection(onLogListener) {
|
|
|
35
35
|
} else {
|
|
36
36
|
conn.xmlInput = function(data) {
|
|
37
37
|
Utils.QBLog('[QBChat]', 'RECV:', data);
|
|
38
|
-
//
|
|
39
|
-
if (onLogListener && typeof onLogListener === 'function') {
|
|
40
|
-
Utils.safeCallbackCall(onLogListener,
|
|
41
|
-
'[QBChat][QBStrophe]' + 'RECV: ' + data);
|
|
42
|
-
}
|
|
43
38
|
//
|
|
44
39
|
try {
|
|
45
40
|
let parser = new DOMParser();
|