quickblox 2.17.2-beta.1-logger → 2.17.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/LICENSE +330 -201
- package/README.md +2 -2
- package/package.json +1 -1
- package/quickblox.js +2905 -3238
- package/quickblox.min.js +1 -1
- package/src/modules/chat/qbChat.js +122 -33
- package/src/modules/webrtc/qbWebRTCSignalingProvider.js +1 -0
- package/src/qbConfig.js +2 -2
- package/src/qbProxy.js +1 -1
|
@@ -751,11 +751,21 @@ ChatProxy.prototype = {
|
|
|
751
751
|
/** Connect for browser env. */
|
|
752
752
|
if (Utils.getEnv().browser) {
|
|
753
753
|
Utils.QBLog('[QBChat]', '!!---Browser env - connected--!!');
|
|
754
|
-
|
|
755
|
-
self.connection.connect(userJid, params.password, function (status) {
|
|
754
|
+
//artik _conn._changeConnectStatus...
|
|
755
|
+
self.connection.connect(userJid, params.password, function (status, condition, elem) {
|
|
756
756
|
Utils.QBLog('[QBChat]', 'self.connection.connect called with status ' + status);
|
|
757
|
+
Utils.QBLog('[QBChat]', 'self.connection.connect called with condition ' + condition);
|
|
758
|
+
Utils.QBLog('[QBChat]', 'self.connection.connect called with elem ' + elem);
|
|
757
759
|
switch (status) {
|
|
758
760
|
case Strophe.Status.ERROR:
|
|
761
|
+
Utils.QBLog('[QBChat]', 'Status.ERROR at ' + chatUtils.getLocalTime());
|
|
762
|
+
Utils.QBLog('[QBChat]', 'ERROR CONDITION: ' + condition);
|
|
763
|
+
|
|
764
|
+
if (typeof self.onLogListener === 'function') {
|
|
765
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
766
|
+
'[QBChat]' + ' Status.ERROR at ' +
|
|
767
|
+
chatUtils.getLocalTime()+ ' ERROR CONDITION: ' + condition);
|
|
768
|
+
}
|
|
759
769
|
self.isConnected = false;
|
|
760
770
|
self._isConnecting = false;
|
|
761
771
|
|
|
@@ -767,6 +777,14 @@ ChatProxy.prototype = {
|
|
|
767
777
|
|
|
768
778
|
break;
|
|
769
779
|
case Strophe.Status.CONNFAIL:
|
|
780
|
+
Utils.QBLog('[QBChat]', 'Status.CONNFAIL at ' + chatUtils.getLocalTime());
|
|
781
|
+
Utils.QBLog('[QBChat]', 'CONNFAIL CONDITION: ' + condition);
|
|
782
|
+
|
|
783
|
+
if (typeof self.onLogListener === 'function') {
|
|
784
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
785
|
+
'[QBChat]' + ' Status.CONNFAIL at ' +
|
|
786
|
+
chatUtils.getLocalTime()+ ' CONNFAIL CONDITION: ' + condition);
|
|
787
|
+
}
|
|
770
788
|
self.isConnected = false;
|
|
771
789
|
self._isConnecting = false;
|
|
772
790
|
|
|
@@ -778,10 +796,24 @@ ChatProxy.prototype = {
|
|
|
778
796
|
|
|
779
797
|
break;
|
|
780
798
|
case Strophe.Status.AUTHENTICATING:
|
|
781
|
-
Utils.QBLog('[QBChat]', 'Status.AUTHENTICATING');
|
|
799
|
+
Utils.QBLog('[QBChat]', 'Status.AUTHENTICATING at ' + chatUtils.getLocalTime());
|
|
800
|
+
Utils.QBLog('[QBChat]', 'AUTHENTICATING CONDITION: ' + condition);
|
|
782
801
|
|
|
802
|
+
if (typeof self.onLogListener === 'function') {
|
|
803
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
804
|
+
'[QBChat]' + ' Status.AUTHENTICATING at ' +
|
|
805
|
+
chatUtils.getLocalTime()+ ' AUTHENTICATING CONDITION: ' + condition);
|
|
806
|
+
}
|
|
783
807
|
break;
|
|
784
808
|
case Strophe.Status.AUTHFAIL:
|
|
809
|
+
Utils.QBLog('[QBChat]', 'Status.AUTHFAIL at ' + chatUtils.getLocalTime());
|
|
810
|
+
Utils.QBLog('[QBChat]', 'AUTHFAIL CONDITION: ' + condition);
|
|
811
|
+
|
|
812
|
+
if (typeof self.onLogListener === 'function') {
|
|
813
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
814
|
+
'[QBChat]' + ' Status.AUTHFAIL at ' +
|
|
815
|
+
chatUtils.getLocalTime()+ ' AUTHFAIL CONDITION: ' + condition);
|
|
816
|
+
}
|
|
785
817
|
self.isConnected = false;
|
|
786
818
|
self._isConnecting = false;
|
|
787
819
|
|
|
@@ -798,9 +830,24 @@ ChatProxy.prototype = {
|
|
|
798
830
|
break;
|
|
799
831
|
case Strophe.Status.CONNECTING:
|
|
800
832
|
Utils.QBLog('[QBChat]', 'Status.CONNECTING', '(Chat Protocol - ' + (config.chatProtocol.active === 1 ? 'BOSH' : 'WebSocket' + ')'));
|
|
833
|
+
Utils.QBLog('[QBChat]', 'Status.CONNECTING at ' + chatUtils.getLocalTime());
|
|
834
|
+
Utils.QBLog('[QBChat]', 'CONNECTING CONDITION: ' + condition);
|
|
801
835
|
|
|
836
|
+
if (typeof self.onLogListener === 'function') {
|
|
837
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
838
|
+
'[QBChat]' + ' Status.CONNECTING at ' + '(Chat Protocol - ' + config.chatProtocol.active === 1 ? 'BOSH' : 'WebSocket' + ')'+
|
|
839
|
+
chatUtils.getLocalTime()+ ' CONNECTING CONDITION: ' + condition);
|
|
840
|
+
}
|
|
802
841
|
break;
|
|
803
842
|
case Strophe.Status.CONNECTED:
|
|
843
|
+
Utils.QBLog('[QBChat]', 'Status.CONNECTED at ' + chatUtils.getLocalTime());
|
|
844
|
+
Utils.QBLog('[QBChat]', 'CONNECTED CONDITION: ' + condition);
|
|
845
|
+
|
|
846
|
+
if (typeof self.onLogListener === 'function') {
|
|
847
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
848
|
+
'[QBChat]' + ' Status.CONNECTED at ' +
|
|
849
|
+
chatUtils.getLocalTime()+ ' CONNECTED CONDITION: ' + condition);
|
|
850
|
+
}
|
|
804
851
|
// Remove any handlers that might exist from a previous connection via
|
|
805
852
|
// extension method added to the connection on initialization in qbMain.
|
|
806
853
|
// NOTE: streamManagement also adds handlers, so do this first.
|
|
@@ -876,17 +923,23 @@ ChatProxy.prototype = {
|
|
|
876
923
|
|
|
877
924
|
break;
|
|
878
925
|
case Strophe.Status.DISCONNECTING:
|
|
879
|
-
Utils.QBLog('[QBChat]', 'Status.DISCONNECTING');
|
|
926
|
+
Utils.QBLog('[QBChat]', 'Status.DISCONNECTING at ' + chatUtils.getLocalTime());
|
|
927
|
+
Utils.QBLog('[QBChat]', 'DISCONNECTING CONDITION: ' + condition);
|
|
928
|
+
|
|
929
|
+
if (typeof self.onLogListener === 'function') {
|
|
930
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
931
|
+
'[QBChat]' + ' Status.DISCONNECTING at ' +
|
|
932
|
+
chatUtils.getLocalTime()+ ' DISCONNECTING CONDITION: ' + condition);
|
|
933
|
+
}
|
|
880
934
|
break;
|
|
881
935
|
case Strophe.Status.DISCONNECTED:
|
|
882
936
|
Utils.QBLog('[QBChat]', 'Status.DISCONNECTED at ' + chatUtils.getLocalTime());
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
//
|
|
937
|
+
Utils.QBLog('[QBChat]', 'DISCONNECTED CONDITION: ' + condition);
|
|
938
|
+
|
|
886
939
|
if (typeof self.onLogListener === 'function') {
|
|
887
940
|
Utils.safeCallbackCall(self.onLogListener,
|
|
888
941
|
'[QBChat]' + ' Status.DISCONNECTED at ' +
|
|
889
|
-
chatUtils.getLocalTime()+ ' DISCONNECTED CONDITION: ' +
|
|
942
|
+
chatUtils.getLocalTime()+ ' DISCONNECTED CONDITION: ' + condition);
|
|
890
943
|
}
|
|
891
944
|
// fire 'onDisconnectedListener' only once
|
|
892
945
|
if (self.isConnected && typeof self.onDisconnectedListener === 'function') {
|
|
@@ -902,32 +955,68 @@ ChatProxy.prototype = {
|
|
|
902
955
|
|
|
903
956
|
break;
|
|
904
957
|
case Strophe.Status.ATTACHED:
|
|
905
|
-
Utils.QBLog('[QBChat]', 'Status.ATTACHED');
|
|
958
|
+
Utils.QBLog('[QBChat]', 'Status.ATTACHED at ' + chatUtils.getLocalTime());
|
|
959
|
+
Utils.QBLog('[QBChat]', 'ATTACHED CONDITION: ' + condition);
|
|
960
|
+
|
|
961
|
+
if (typeof self.onLogListener === 'function') {
|
|
962
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
963
|
+
'[QBChat]' + ' Status.ATTACHED at ' +
|
|
964
|
+
chatUtils.getLocalTime()+ ' ATTACHED CONDITION: ' + condition);
|
|
965
|
+
}
|
|
906
966
|
break;
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
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
|
-
}
|
|
967
|
+
case Strophe.Status.REDIRECT:
|
|
968
|
+
Utils.QBLog('[QBChat]', 'Status.REDIRECT at ' + chatUtils.getLocalTime());
|
|
969
|
+
Utils.QBLog('[QBChat]', 'REDIRECT CONDITION: ' + condition);
|
|
970
|
+
|
|
971
|
+
if (typeof self.onLogListener === 'function') {
|
|
972
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
973
|
+
'[QBChat]' + ' Status.REDIRECT at ' +
|
|
974
|
+
chatUtils.getLocalTime()+ ' REDIRECT CONDITION: ' + condition);
|
|
925
975
|
}
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
976
|
+
break;
|
|
977
|
+
case Strophe.Status.CONNTIMEOUT:
|
|
978
|
+
Utils.QBLog('[QBChat]', 'Status.CONNTIMEOUT at ' + chatUtils.getLocalTime());
|
|
979
|
+
Utils.QBLog('[QBChat]', 'CONNTIMEOUT CONDITION: ' + condition);
|
|
980
|
+
|
|
981
|
+
if (typeof self.onLogListener === 'function') {
|
|
982
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
983
|
+
'[QBChat]' + ' Status.CONNTIMEOUT at ' +
|
|
984
|
+
chatUtils.getLocalTime()+ ' CONNTIMEOUT CONDITION: ' + condition);
|
|
985
|
+
}
|
|
986
|
+
break;
|
|
987
|
+
case Strophe.Status.BINDREQUIRED:
|
|
988
|
+
Utils.QBLog('[QBChat]', 'Status.BINDREQUIRED at ' + chatUtils.getLocalTime());
|
|
989
|
+
Utils.QBLog('[QBChat]', 'BINDREQUIRED CONDITION: ' + condition);
|
|
990
|
+
|
|
991
|
+
if (typeof self.onLogListener === 'function') {
|
|
992
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
993
|
+
'[QBChat]' + ' Status.BINDREQUIRED at ' +
|
|
994
|
+
chatUtils.getLocalTime()+ ' BINDREQUIRED CONDITION: ' + condition);
|
|
995
|
+
}
|
|
996
|
+
break;
|
|
997
|
+
case Strophe.Status.ATTACHFAIL:
|
|
998
|
+
Utils.QBLog('[QBChat]', 'Status.ATTACHFAIL at ' + chatUtils.getLocalTime());
|
|
999
|
+
Utils.QBLog('[QBChat]', 'ATTACHFAIL CONDITION: ' + condition);
|
|
1000
|
+
|
|
1001
|
+
if (typeof self.onLogListener === 'function') {
|
|
1002
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
1003
|
+
'[QBChat]' + ' Status.ATTACHFAIL at ' +
|
|
1004
|
+
chatUtils.getLocalTime()+ ' ATTACHFAIL CONDITION: ' + condition);
|
|
1005
|
+
}
|
|
1006
|
+
break;
|
|
1007
|
+
|
|
1008
|
+
default:
|
|
1009
|
+
Utils.QBLog('[QBChat]', 'Status is unknown at ' + chatUtils.getLocalTime());
|
|
1010
|
+
Utils.QBLog('[QBChat]', 'unknown CONDITION: ' + condition);
|
|
1011
|
+
|
|
1012
|
+
if (typeof self.onLogListener === 'function') {
|
|
1013
|
+
Utils.safeCallbackCall(self.onLogListener,
|
|
1014
|
+
'[QBChat]' + ' Status is unknown at ' +
|
|
1015
|
+
chatUtils.getLocalTime()+ ' unknown CONDITION: ' + condition);
|
|
1016
|
+
}
|
|
1017
|
+
break;
|
|
929
1018
|
}
|
|
930
|
-
};
|
|
1019
|
+
});
|
|
931
1020
|
}
|
|
932
1021
|
|
|
933
1022
|
/** connect for node */
|
|
@@ -1130,7 +1219,7 @@ ChatProxy.prototype = {
|
|
|
1130
1219
|
|
|
1131
1220
|
if (Utils.getEnv().browser) {
|
|
1132
1221
|
this.connection.flush();
|
|
1133
|
-
this.connection.disconnect()
|
|
1222
|
+
this.connection.disconnect('reconnect from SDK');//artik should be added reasone = 'reconnect from SDK'
|
|
1134
1223
|
} else {
|
|
1135
1224
|
this.Client.end();
|
|
1136
1225
|
}
|
|
@@ -1517,7 +1606,7 @@ ChatProxy.prototype = {
|
|
|
1517
1606
|
|
|
1518
1607
|
if (Utils.getEnv().browser) {
|
|
1519
1608
|
this.connection.flush();
|
|
1520
|
-
this.connection.disconnect()
|
|
1609
|
+
this.connection.disconnect('disconnect from SDK');//artik should add reason = 'disconnect from SDK'
|
|
1521
1610
|
if (this._checkConnectionPingTimer !== undefined) {
|
|
1522
1611
|
Utils.QBLog('[QBChat]', 'Stop ping');
|
|
1523
1612
|
clearInterval(this._checkConnectionPingTimer);
|
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) {
|