quickblox 2.15.1 → 2.15.3
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 +3 -3
- package/quickblox.js +19027 -19112
- package/quickblox.min.js +1 -1
- package/src/modules/chat/qbChat.js +240 -326
- package/src/modules/chat/qbDialog.js +12 -12
- package/src/modules/chat/qbMessage.js +18 -18
- package/src/modules/qbAddressBook.js +4 -4
- package/src/modules/qbContent.js +71 -71
- package/src/modules/qbData.js +65 -66
- package/src/modules/qbPushNotifications.js +77 -73
- package/src/modules/qbUsers.js +77 -77
- package/src/modules/webrtc/qbRTCPeerConnection.js +30 -4
- package/src/modules/webrtc/qbWebRTCClient.js +28 -15
- package/src/modules/webrtc/qbWebRTCSession.js +80 -50
- package/src/plugins/streamManagement.js +11 -8
- package/src/qbConfig.js +2 -2
- package/src/qbMain.js +18 -16
- package/src/qbProxy.js +8 -1
- package/src/qbUtils.js +5 -1
|
@@ -15,11 +15,15 @@
|
|
|
15
15
|
* - onReconnectListener(session, userId, state)
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @namespace QB.webrtc.WebRTCSession
|
|
20
|
+
*/
|
|
21
|
+
|
|
18
22
|
/**
|
|
19
23
|
* @typedef {Object} MediaParams
|
|
20
24
|
* @property {boolean | MediaTrackConstraints} [params.audio]
|
|
21
25
|
* @property {boolean | MediaTrackConstraints} [params.video]
|
|
22
|
-
* @property {string} [params.elemId] Id of HTMLVideoElement
|
|
26
|
+
* @property {string} [params.elemId] - Id of HTMLVideoElement.
|
|
23
27
|
* @property {Object} [params.options]
|
|
24
28
|
* @property {boolean} [params.options.muted]
|
|
25
29
|
* @property {boolean} [params.options.mirror]
|
|
@@ -52,16 +56,16 @@ var ReconnectionState = {
|
|
|
52
56
|
|
|
53
57
|
|
|
54
58
|
/**
|
|
55
|
-
* QuickBlox WebRTC session
|
|
59
|
+
* QuickBlox WebRTC session.
|
|
56
60
|
* @param {Object} params
|
|
57
|
-
* @param {1|2} params.callType Type of a call
|
|
61
|
+
* @param {1|2} params.callType - Type of a call
|
|
58
62
|
* 1 - VIDEO
|
|
59
63
|
* 2 - AUDIO
|
|
60
|
-
* @param {Array<number>} params.opIDs An array with opponents
|
|
61
|
-
* @param {number} params.currentUserID Current user ID
|
|
62
|
-
* @param {number} params.initiatorID Call initiator ID
|
|
63
|
-
* @param {string} [params.sessionID] Session identifier (optional)
|
|
64
|
-
* @param {number} [params.bandwidth] Bandwidth limit
|
|
64
|
+
* @param {Array<number>} params.opIDs - An array with opponents.
|
|
65
|
+
* @param {number} params.currentUserID - Current user ID.
|
|
66
|
+
* @param {number} params.initiatorID - Call initiator ID.
|
|
67
|
+
* @param {string} [params.sessionID] - Session identifier (optional).
|
|
68
|
+
* @param {number} [params.bandwidth] - Bandwidth limit.
|
|
65
69
|
*/
|
|
66
70
|
function WebRTCSession(params) {
|
|
67
71
|
this.ID = params.sessionID ? params.sessionID : generateUUID();
|
|
@@ -70,13 +74,13 @@ function WebRTCSession(params) {
|
|
|
70
74
|
this.initiatorID = parseInt(params.initiatorID);
|
|
71
75
|
this.opponentsIDs = params.opIDs;
|
|
72
76
|
this.callType = parseInt(params.callType);
|
|
73
|
-
|
|
77
|
+
/*** @type {{[userId: number]: qbRTCPeerConnection}} */
|
|
74
78
|
this.peerConnections = {};
|
|
75
|
-
|
|
79
|
+
/*** @type {MediaParams} */
|
|
76
80
|
this.mediaParams = null;
|
|
77
|
-
|
|
81
|
+
/*** @type {{[userID: number]: number | undefined}} */
|
|
78
82
|
this.iceConnectTimers = {};
|
|
79
|
-
|
|
83
|
+
/*** @type {{[userID: number]: number | undefined}} */
|
|
80
84
|
this.reconnectTimers = {};
|
|
81
85
|
|
|
82
86
|
this.signalingProvider = params.signalingProvider;
|
|
@@ -85,7 +89,7 @@ function WebRTCSession(params) {
|
|
|
85
89
|
|
|
86
90
|
this.bandwidth = params.bandwidth;
|
|
87
91
|
|
|
88
|
-
|
|
92
|
+
/***
|
|
89
93
|
* We use this timeout to fix next issue:
|
|
90
94
|
* "From Android/iOS make a call to Web and kill the Android/iOS app instantly. Web accept/reject popup will be still visible.
|
|
91
95
|
* We need a way to hide it if sach situation happened."
|
|
@@ -94,14 +98,16 @@ function WebRTCSession(params) {
|
|
|
94
98
|
|
|
95
99
|
this.startCallTime = 0;
|
|
96
100
|
this.acceptCallTime = 0;
|
|
97
|
-
|
|
101
|
+
/*** @type {MediaStream | undefined} */
|
|
98
102
|
this.localStream = undefined;
|
|
99
103
|
}
|
|
100
104
|
|
|
101
105
|
/**
|
|
102
|
-
* Get the user media stream
|
|
103
|
-
* @
|
|
104
|
-
* @
|
|
106
|
+
* Get the user media stream({@link https://docs.quickblox.com/docs/js-video-calling#access-local-media-stream read more}).
|
|
107
|
+
* @function getUserMedia
|
|
108
|
+
* @memberof QB.webrtc.WebRTCSession
|
|
109
|
+
* @param {MediaParams} params - Media stream constraints and additional options.
|
|
110
|
+
* @param {Function} callback - Callback to get a result of the function.
|
|
105
111
|
*/
|
|
106
112
|
WebRTCSession.prototype.getUserMedia = function (params, callback) {
|
|
107
113
|
if (!navigator.mediaDevices.getUserMedia) {
|
|
@@ -135,8 +141,10 @@ WebRTCSession.prototype.getUserMedia = function (params, callback) {
|
|
|
135
141
|
};
|
|
136
142
|
|
|
137
143
|
/**
|
|
138
|
-
* Get the state of connection
|
|
139
|
-
* @
|
|
144
|
+
* Get the state of connection.
|
|
145
|
+
* @function connectionStateForUser
|
|
146
|
+
* @memberof QB.webrtc.WebRTCSession
|
|
147
|
+
* @param {number} userID
|
|
140
148
|
*/
|
|
141
149
|
WebRTCSession.prototype.connectionStateForUser = function (userID) {
|
|
142
150
|
var peerConnection = this.peerConnections[userID];
|
|
@@ -144,12 +152,14 @@ WebRTCSession.prototype.connectionStateForUser = function (userID) {
|
|
|
144
152
|
};
|
|
145
153
|
|
|
146
154
|
/**
|
|
147
|
-
* Attach media stream to audio/video element
|
|
148
|
-
* @
|
|
149
|
-
* @
|
|
150
|
-
* @param {
|
|
151
|
-
* @param {
|
|
152
|
-
* @param {
|
|
155
|
+
* Attach media stream to audio/video element({@link https://docs.quickblox.com/docs/js-video-calling#attach-local-media-stream read more}).
|
|
156
|
+
* @function attachMediaStream
|
|
157
|
+
* @memberof QB.webrtc.WebRTCSession
|
|
158
|
+
* @param {string} elementId - The Id of an ellement to attach a stream.
|
|
159
|
+
* @param {MediaStream} stream - The stream to attach.
|
|
160
|
+
* @param {Object} [options] - The additional options.
|
|
161
|
+
* @param {boolean} [options.muted] - Whether video element should be muted.
|
|
162
|
+
* @param {boolean} [options.mirror] - Whether video should be "mirrored".
|
|
153
163
|
*/
|
|
154
164
|
WebRTCSession.prototype.attachMediaStream = function (elementId, stream, options) {
|
|
155
165
|
var elem = document.getElementById(elementId);
|
|
@@ -184,8 +194,10 @@ WebRTCSession.prototype.attachMediaStream = function (elementId, stream, options
|
|
|
184
194
|
};
|
|
185
195
|
|
|
186
196
|
/**
|
|
187
|
-
* Detach media stream from audio/video element
|
|
188
|
-
* @
|
|
197
|
+
* Detach media stream from audio/video element.
|
|
198
|
+
* @function detachMediaStream
|
|
199
|
+
* @memberof QB.webrtc.WebRTCSession
|
|
200
|
+
* @param {string} elementId - The Id of an element to detach a stream.
|
|
189
201
|
*/
|
|
190
202
|
WebRTCSession.prototype.detachMediaStream = function (elementId) {
|
|
191
203
|
var elem = document.getElementById(elementId);
|
|
@@ -209,11 +221,13 @@ WebRTCSession.prototype.detachMediaStream = function (elementId) {
|
|
|
209
221
|
};
|
|
210
222
|
|
|
211
223
|
/**
|
|
212
|
-
* Switch media tracks in audio/video HTML's element and replace its in peers.
|
|
213
|
-
* @
|
|
214
|
-
* @
|
|
215
|
-
* @param {
|
|
216
|
-
* @param {
|
|
224
|
+
* Switch media tracks in audio/video HTML's element and replace its in peers({@link https://docs.quickblox.com/docs/js-video-calling-advanced#switch-camera read more}).
|
|
225
|
+
* @function switchMediaTracks
|
|
226
|
+
* @memberof QB.webrtc.WebRTCSession
|
|
227
|
+
* @param {Object} deviceIds - An object with deviceIds of plugged devices.
|
|
228
|
+
* @param {string} [deviceIds.audio] - The deviceId, it can be gotten from QB.webrtc.getMediaDevices('audioinput').
|
|
229
|
+
* @param {string} [deviceIds.video] - The deviceId, it can be gotten from QB.webrtc.getMediaDevices('videoinput').
|
|
230
|
+
* @param {Function} callback - The callback to get a result of the function.
|
|
217
231
|
*/
|
|
218
232
|
WebRTCSession.prototype.switchMediaTracks = function (deviceIds, callback) {
|
|
219
233
|
if (!navigator.mediaDevices.getUserMedia) {
|
|
@@ -269,7 +283,7 @@ WebRTCSession.prototype._replaceTracks = function (stream) {
|
|
|
269
283
|
this.attachMediaStream(elemId, stream, ops);
|
|
270
284
|
}
|
|
271
285
|
|
|
272
|
-
|
|
286
|
+
/*** @param {RTCPeerConnection} peer */
|
|
273
287
|
function _replaceTracksForPeer(peer) {
|
|
274
288
|
return Promise.all(peer.getSenders().map(function (sender) {
|
|
275
289
|
return sender.replaceTrack(newStreamTracks.find(function (track) {
|
|
@@ -286,8 +300,10 @@ WebRTCSession.prototype._replaceTracks = function (stream) {
|
|
|
286
300
|
};
|
|
287
301
|
|
|
288
302
|
/**
|
|
289
|
-
* Initiate a call
|
|
290
|
-
* @
|
|
303
|
+
* Initiate a call({@link https://docs.quickblox.com/docs/js-video-calling#make-a-call read more}).
|
|
304
|
+
* @function call
|
|
305
|
+
* @memberof QB.webrtc.WebRTCSession
|
|
306
|
+
* @param {Object} [extension] - A map with a custom parametrs .
|
|
291
307
|
* @param {Function} [callback]
|
|
292
308
|
*/
|
|
293
309
|
WebRTCSession.prototype.call = function (extension, callback) {
|
|
@@ -331,8 +347,10 @@ WebRTCSession.prototype._callInternal = function (userID, extension) {
|
|
|
331
347
|
};
|
|
332
348
|
|
|
333
349
|
/**
|
|
334
|
-
* Accept a call
|
|
335
|
-
* @
|
|
350
|
+
* Accept a call({@link https://docs.quickblox.com/docs/js-video-calling#accept-a-call read more}).
|
|
351
|
+
* @function accept
|
|
352
|
+
* @memberof QB.webrtc.WebRTCSession
|
|
353
|
+
* @param {Object} extension - A map with custom parameters.
|
|
336
354
|
*/
|
|
337
355
|
WebRTCSession.prototype.accept = function (extension) {
|
|
338
356
|
var self = this,
|
|
@@ -429,8 +447,10 @@ WebRTCSession.prototype._acceptInternal = function (userID, extension) {
|
|
|
429
447
|
};
|
|
430
448
|
|
|
431
449
|
/**
|
|
432
|
-
* Reject a call
|
|
433
|
-
* @
|
|
450
|
+
* Reject a call({@link https://docs.quickblox.com/docs/js-video-calling#reject-a-call read more}).
|
|
451
|
+
* @function reject
|
|
452
|
+
* @memberof QB.webrtc.WebRTCSession
|
|
453
|
+
* @param {Object} extension - A map with custom parameters.
|
|
434
454
|
*/
|
|
435
455
|
WebRTCSession.prototype.reject = function (extension) {
|
|
436
456
|
var self = this,
|
|
@@ -460,8 +480,10 @@ WebRTCSession.prototype.reject = function (extension) {
|
|
|
460
480
|
};
|
|
461
481
|
|
|
462
482
|
/**
|
|
463
|
-
* Stop a call
|
|
464
|
-
* @
|
|
483
|
+
* Stop a call({@link https://docs.quickblox.com/docs/js-video-calling#end-a-call read more}).
|
|
484
|
+
* @function stop
|
|
485
|
+
* @memberof QB.webrtc.WebRTCSession
|
|
486
|
+
* @param {Object} extension - A map with custom parameters.
|
|
465
487
|
*/
|
|
466
488
|
WebRTCSession.prototype.stop = function (extension) {
|
|
467
489
|
var self = this,
|
|
@@ -493,8 +515,10 @@ WebRTCSession.prototype.stop = function (extension) {
|
|
|
493
515
|
};
|
|
494
516
|
|
|
495
517
|
/**
|
|
496
|
-
*
|
|
497
|
-
* @
|
|
518
|
+
* Close connection with a user.
|
|
519
|
+
* @function closeConnection
|
|
520
|
+
* @memberof QB.webrtc.WebRTCSession
|
|
521
|
+
* @param {Number} userId - Id of a user.
|
|
498
522
|
*/
|
|
499
523
|
WebRTCSession.prototype.closeConnection = function (userId) {
|
|
500
524
|
var self = this,
|
|
@@ -516,8 +540,10 @@ WebRTCSession.prototype.closeConnection = function (userId) {
|
|
|
516
540
|
|
|
517
541
|
|
|
518
542
|
/**
|
|
519
|
-
* Update a call
|
|
520
|
-
* @
|
|
543
|
+
* Update a call.
|
|
544
|
+
* @function update
|
|
545
|
+
* @memberof QB.webrtc.WebRTCSession
|
|
546
|
+
* @param {Object} extension - A map with custom parameters.
|
|
521
547
|
* @param {number} [userID]
|
|
522
548
|
*/
|
|
523
549
|
WebRTCSession.prototype.update = function (extension, userID) {
|
|
@@ -555,16 +581,20 @@ WebRTCSession.prototype.update = function (extension, userID) {
|
|
|
555
581
|
};
|
|
556
582
|
|
|
557
583
|
/**
|
|
558
|
-
* Mutes the stream
|
|
559
|
-
* @
|
|
584
|
+
* Mutes the stream({@link https://docs.quickblox.com/docs/js-video-calling-advanced#mute-audio read more}).
|
|
585
|
+
* @function mute
|
|
586
|
+
* @memberof QB.webrtc.WebRTCSession
|
|
587
|
+
* @param {string} type - 'audio' or 'video'
|
|
560
588
|
*/
|
|
561
589
|
WebRTCSession.prototype.mute = function (type) {
|
|
562
590
|
this._muteStream(0, type);
|
|
563
591
|
};
|
|
564
592
|
|
|
565
593
|
/**
|
|
566
|
-
* Unmutes the stream
|
|
567
|
-
* @
|
|
594
|
+
* Unmutes the stream({@link https://docs.quickblox.com/docs/js-video-calling-advanced#mute-audio read more}).
|
|
595
|
+
* @function unmute
|
|
596
|
+
* @memberof QB.webrtc.WebRTCSession
|
|
597
|
+
* @param {string} type - 'audio' or 'video'
|
|
568
598
|
*/
|
|
569
599
|
WebRTCSession.prototype.unmute = function (type) {
|
|
570
600
|
this._muteStream(1, type);
|
|
@@ -746,7 +776,7 @@ WebRTCSession.prototype._processReconnectOffer = function (userID, SRD) {
|
|
|
746
776
|
|
|
747
777
|
/**
|
|
748
778
|
* @param {number} userID
|
|
749
|
-
* @param {RTCSessionDescriptionInit
|
|
779
|
+
* @param {RTCSessionDescriptionInit} SRD
|
|
750
780
|
*/
|
|
751
781
|
WebRTCSession.prototype._processReconnectAnswer = function (userID, SRD) {
|
|
752
782
|
var peer = this.peerConnections[userID];
|
|
@@ -45,7 +45,7 @@ function StreamManagement(options) {
|
|
|
45
45
|
|
|
46
46
|
this._intervalId = null;
|
|
47
47
|
|
|
48
|
-
this._timeInterval =
|
|
48
|
+
this._timeInterval = Utils.getTimeIntervalForCallBackMessage();
|
|
49
49
|
|
|
50
50
|
this.sentMessageCallback = null;
|
|
51
51
|
|
|
@@ -214,14 +214,17 @@ StreamManagement.prototype.getClientSentStanzasCounter = function(){
|
|
|
214
214
|
};
|
|
215
215
|
|
|
216
216
|
StreamManagement.prototype._checkCounterOnIncomeStanza = function (count){
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
217
|
+
var updatedStanzasQueue = [];
|
|
218
|
+
|
|
219
|
+
if(this._stanzasQueue.length){
|
|
220
|
+
for(var i = 0; i < this._stanzasQueue.length; i++){
|
|
221
|
+
if(this._stanzasQueue[i].expect == count){
|
|
222
|
+
this.sentMessageCallback(null, this._stanzasQueue[i].message);
|
|
223
|
+
} else {
|
|
224
|
+
updatedStanzasQueue.push(this._stanzasQueue[i]);
|
|
225
|
+
}
|
|
222
226
|
}
|
|
223
|
-
|
|
224
|
-
this._stanzasQueue.shift();
|
|
227
|
+
this._stanzasQueue = updatedStanzasQueue;
|
|
225
228
|
}
|
|
226
229
|
};
|
|
227
230
|
|
package/src/qbConfig.js
CHANGED
package/src/qbMain.js
CHANGED
|
@@ -29,12 +29,14 @@ QuickBlox.prototype = {
|
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* @memberof QB
|
|
32
|
+
* Initialize QuickBlox SDK({@link https://docs.quickblox.com/docs/js-setup#initialize-quickblox-sdk read more})
|
|
32
33
|
* @param {Number | String} appIdOrToken - Application ID (from your admin panel) or Session Token.
|
|
33
34
|
* @param {String | Number} authKeyOrAppId - Authorization key or Application ID. You need to set up Application ID if you use session token as appIdOrToken parameter.
|
|
34
35
|
* @param {String} authSecret - Authorization secret key (from your admin panel).
|
|
35
36
|
* @param {Object} configMap - Settings object for QuickBlox SDK.
|
|
36
37
|
*/
|
|
37
38
|
init: function(appIdOrToken, authKeyOrAppId, authSecret, accountKey, configMap) {
|
|
39
|
+
console.log('current platform: ', Utils.getEnv());
|
|
38
40
|
if (typeof accountKey === 'string' && accountKey.length) {
|
|
39
41
|
if (configMap && typeof configMap === 'object') {
|
|
40
42
|
config.set(configMap);
|
|
@@ -133,7 +135,7 @@ QuickBlox.prototype = {
|
|
|
133
135
|
},
|
|
134
136
|
|
|
135
137
|
/**
|
|
136
|
-
* Init QuickBlox SDK with User Account data
|
|
138
|
+
* Init QuickBlox SDK with User Account data to start session with token({@link https://docs.quickblox.com/docs/js-setup#initialize-quickblox-sdk-without-authorization-key-and-secret read more}).
|
|
137
139
|
* @memberof QB
|
|
138
140
|
* @param {Number} appId - Application ID (from your admin panel).
|
|
139
141
|
* @param {String | Number} accountKey - Account key (from your admin panel).
|
|
@@ -153,28 +155,28 @@ QuickBlox.prototype = {
|
|
|
153
155
|
},
|
|
154
156
|
|
|
155
157
|
/**
|
|
156
|
-
* Return current session
|
|
158
|
+
* Return current session({@link https://docs.quickblox.com/docs/js-authentication#get-session read more}).
|
|
157
159
|
* @memberof QB
|
|
158
160
|
* @param {getSessionCallback} callback - The getSessionCallback function.
|
|
159
161
|
* */
|
|
160
162
|
getSession: function(callback) {
|
|
161
163
|
/**
|
|
162
|
-
* This callback return session object
|
|
164
|
+
* This callback return session object..
|
|
163
165
|
* @callback getSessionCallback
|
|
164
|
-
* @param {Object} error - The error object
|
|
165
|
-
* @param {Object} session - Contains of session object
|
|
166
|
+
* @param {Object} error - The error object.
|
|
167
|
+
* @param {Object} session - Contains of session object.
|
|
166
168
|
* */
|
|
167
169
|
this.auth.getSession(callback);
|
|
168
170
|
},
|
|
169
171
|
|
|
170
172
|
/**
|
|
171
|
-
* Set up user session token to current session and return it
|
|
173
|
+
* Set up user session token to current session and return it({@link https://docs.quickblox.com/docs/js-authentication#set-existing-session read more}).
|
|
172
174
|
* @memberof QB
|
|
173
|
-
* @param {String} token -
|
|
175
|
+
* @param {String} token - A User Session Token.
|
|
174
176
|
* @param {getSessionCallback} callback - The getSessionCallback function.
|
|
175
177
|
* @callback getSessionCallback
|
|
176
|
-
* @param {Object} error - The error object
|
|
177
|
-
* @param {Object} session - Contains of session object
|
|
178
|
+
* @param {Object} error - The error object.
|
|
179
|
+
* @param {Object} session - Contains of session object.
|
|
178
180
|
* */
|
|
179
181
|
startSessionWithToken: function(token, callback) {
|
|
180
182
|
if (token === undefined) throw new Error('Cannot start session with undefined token');
|
|
@@ -202,23 +204,23 @@ QuickBlox.prototype = {
|
|
|
202
204
|
},
|
|
203
205
|
|
|
204
206
|
/**
|
|
205
|
-
*
|
|
207
|
+
* Create new session({@link https://docs.quickblox.com/docs/js-authentication#create-session read more}).
|
|
206
208
|
* @memberof QB
|
|
207
209
|
* @param {String} appIdOrToken Should be applecationID or QBtoken.
|
|
208
|
-
* @param {createSessionCallback} callback
|
|
210
|
+
* @param {createSessionCallback} callback
|
|
209
211
|
* */
|
|
210
212
|
createSession: function(params, callback) {
|
|
211
213
|
/**
|
|
212
214
|
* This callback return session object.
|
|
213
215
|
* @callback createSession
|
|
214
|
-
* @param {Object} error - The error object
|
|
215
|
-
* @param {Object} session - Contains of session object
|
|
216
|
+
* @param {Object} error - The error object.
|
|
217
|
+
* @param {Object} session - Contains of session object.
|
|
216
218
|
* */
|
|
217
219
|
this.auth.createSession(params, callback);
|
|
218
220
|
},
|
|
219
221
|
|
|
220
222
|
/**
|
|
221
|
-
* Destroy current session
|
|
223
|
+
* Destroy current session({@link https://docs.quickblox.com/docs/js-authentication#destroy-session-token read more}).
|
|
222
224
|
* @memberof QB
|
|
223
225
|
* @param {destroySessionCallback} callback - The destroySessionCallback function.
|
|
224
226
|
* */
|
|
@@ -233,7 +235,7 @@ QuickBlox.prototype = {
|
|
|
233
235
|
},
|
|
234
236
|
|
|
235
237
|
/**
|
|
236
|
-
* Login to QuickBlox application
|
|
238
|
+
* Login to QuickBlox application({@link https://docs.quickblox.com/docs/js-authentication#log-in-user read more}).
|
|
237
239
|
* @memberof QB
|
|
238
240
|
* @param {Object} params - Params object for login into the session.
|
|
239
241
|
* @param {loginCallback} callback - The loginCallback function.
|
|
@@ -249,7 +251,7 @@ QuickBlox.prototype = {
|
|
|
249
251
|
},
|
|
250
252
|
|
|
251
253
|
/**
|
|
252
|
-
* Remove user from current session, but doesn't destroy it.
|
|
254
|
+
* Remove user from current session, but doesn't destroy it({@link https://docs.quickblox.com/docs/js-authentication#log-out-user read more}).
|
|
253
255
|
* @memberof QB
|
|
254
256
|
* @param {logoutCallback} callback - The logoutCallback function.
|
|
255
257
|
* */
|
package/src/qbProxy.js
CHANGED
|
@@ -139,7 +139,7 @@ ServiceProxy.prototype = {
|
|
|
139
139
|
qbFetch(qbUrl, qbRequest)
|
|
140
140
|
.then(function(response) {
|
|
141
141
|
qbResponse = response;
|
|
142
|
-
|
|
142
|
+
console.log('qbProxy fetch then 1');
|
|
143
143
|
if (qbRequest.method === 'GET' || qbRequest.method === 'POST'){
|
|
144
144
|
var qbTokenExpirationDate = qbResponse.headers.get('qb-token-expirationdate');
|
|
145
145
|
var headerHasToken = !(qbTokenExpirationDate === null ||
|
|
@@ -163,9 +163,16 @@ ServiceProxy.prototype = {
|
|
|
163
163
|
|
|
164
164
|
return ' ';
|
|
165
165
|
}).then(function(body) {
|
|
166
|
+
//console.log('HTTP status code: ', qbResponse.headers.status);
|
|
167
|
+
//console.log('HTTP response: ', qbResponse);
|
|
168
|
+
console.log('qbProxy fetch then 2');
|
|
169
|
+
console.log('HTTP body: ', qbResponse);
|
|
166
170
|
_requestCallback(null, qbResponse, body);
|
|
167
171
|
}, function(error) {
|
|
168
172
|
_requestCallback(error);
|
|
173
|
+
}).catch((error) => {
|
|
174
|
+
console.log('qbProxy fetch ... catch, error: ', error);
|
|
175
|
+
_requestCallback(error);
|
|
169
176
|
});
|
|
170
177
|
|
|
171
178
|
/*
|
package/src/qbUtils.js
CHANGED
|
@@ -320,8 +320,12 @@ var Utils = {
|
|
|
320
320
|
merged.push(newItem);
|
|
321
321
|
}
|
|
322
322
|
return merged;
|
|
323
|
-
}
|
|
323
|
+
},
|
|
324
324
|
|
|
325
|
+
getTimeIntervalForCallBackMessage: function() {
|
|
326
|
+
const timeInterval = typeof config.callBackInterval === 'undefined' ? 2 : config.callBackInterval;
|
|
327
|
+
return timeInterval * 1000;
|
|
328
|
+
}
|
|
325
329
|
};
|
|
326
330
|
|
|
327
331
|
module.exports = Utils;
|