quickblox 2.21.0 → 2.21.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/README.md +6 -2
- package/package.json +1 -1
- package/quickblox.d.ts +9 -2
- package/quickblox.js +136 -42
- package/src/modules/webrtc/qbWebRTCSession.js +16 -6
- package/src/modules/webrtc/qbWebRTCSignalingProcessor.js +20 -1
- package/src/modules/webrtc/qbWebRTCSignalingProvider.js +20 -1
- package/src/qbConfig.js +47 -25
- package/src/qbMain.js +5 -5
- package/src/qbStrophe.js +25 -1
package/README.md
CHANGED
|
@@ -54,8 +54,12 @@ var QB2 = new QuickBlox();
|
|
|
54
54
|
# Browsers support
|
|
55
55
|
|
|
56
56
|
| Edge | Firefox | Chrome | Safari | Opera | Node.js |
|
|
57
|
-
| :--: | :-----: | :----: | :----: | :---:
|
|
58
|
-
| 14+ | 52+ | 50+ | 11.1+ | 36+ |
|
|
57
|
+
| :--: | :-----: | :----: | :----: | :---: |:-------:|
|
|
58
|
+
| 14+ | 52+ | 50+ | 11.1+ | 36+ | 10+ |
|
|
59
|
+
|
|
60
|
+
## Node.js
|
|
61
|
+
- **Minimum:** v10.0.0
|
|
62
|
+
- **Recommended:** v12.20.0+
|
|
59
63
|
|
|
60
64
|
# Documentation
|
|
61
65
|
|
package/package.json
CHANGED
package/quickblox.d.ts
CHANGED
|
@@ -116,6 +116,12 @@ export declare interface QBConfig {
|
|
|
116
116
|
* Set the number of seconds for the statistical information to be received.
|
|
117
117
|
*/
|
|
118
118
|
statsReportTimeInterval?: boolean
|
|
119
|
+
/**
|
|
120
|
+
* Transport policy for ICE candidate gathering.
|
|
121
|
+
* Mirrors RTCPeerConnection. Allowed: "all" | "relay".
|
|
122
|
+
* When "relay", only TURN-relayed candidates will be used.
|
|
123
|
+
*/
|
|
124
|
+
iceTransportPolicy?: 'all' | 'relay'
|
|
119
125
|
/**
|
|
120
126
|
* You can customize a list of ICE servers. By default,
|
|
121
127
|
* WebRTC module will use internal ICE servers that are usually enough,
|
|
@@ -268,7 +274,7 @@ export declare interface ChatMessageAttachment {
|
|
|
268
274
|
duration?: string | number
|
|
269
275
|
/* Custom parameters. Useful for storing metadata of attachment */
|
|
270
276
|
data?: string
|
|
271
|
-
[key: string]: string | undefined
|
|
277
|
+
[key: string]: string | number | undefined
|
|
272
278
|
}
|
|
273
279
|
|
|
274
280
|
declare enum QBChatDialogType {
|
|
@@ -411,7 +417,7 @@ export declare interface QBChatXMPPMessage {
|
|
|
411
417
|
date_sent: string
|
|
412
418
|
save_to_history: string
|
|
413
419
|
attachments?: ChatMessageAttachment[]
|
|
414
|
-
[custom_field_N: string]: string
|
|
420
|
+
[custom_field_N: string]: string
|
|
415
421
|
}
|
|
416
422
|
}
|
|
417
423
|
|
|
@@ -1326,6 +1332,7 @@ export declare interface QBWebRTCModule {
|
|
|
1326
1332
|
session: QBWebRTCSession,
|
|
1327
1333
|
userId: QBUser['id'],
|
|
1328
1334
|
stats: any,
|
|
1335
|
+
error?: unknown,
|
|
1329
1336
|
) => void
|
|
1330
1337
|
onRejectCallListener?: (
|
|
1331
1338
|
session: QBWebRTCSession,
|
package/quickblox.js
CHANGED
|
@@ -54154,9 +54154,14 @@ WebRTCSession.prototype._createPeer = function (userId, polite) {
|
|
|
54154
54154
|
|
|
54155
54155
|
this.startCallTime = new Date();
|
|
54156
54156
|
|
|
54157
|
-
var pcConfig = {
|
|
54158
|
-
|
|
54159
|
-
};
|
|
54157
|
+
// var pcConfig = {
|
|
54158
|
+
// iceServers: config.webrtc.iceServers,
|
|
54159
|
+
// };
|
|
54160
|
+
const base = { iceServers: config.webrtc.iceServers };
|
|
54161
|
+
const extra = (typeof config.webrtc.iceTransportPolicy === 'undefined') ? {}
|
|
54162
|
+
: { iceTransportPolicy: config.webrtc.iceTransportPolicy };
|
|
54163
|
+
|
|
54164
|
+
const pcConfig = Object.assign({}, base, extra);
|
|
54160
54165
|
|
|
54161
54166
|
Helpers.trace("_createPeer configuration: " + JSON.stringify(pcConfig));
|
|
54162
54167
|
|
|
@@ -54321,9 +54326,14 @@ WebRTCSession.prototype._reconnect = function (peerConnection, negotiate) {
|
|
|
54321
54326
|
|
|
54322
54327
|
peerConnection.release();
|
|
54323
54328
|
|
|
54324
|
-
var pcConfig = {
|
|
54325
|
-
|
|
54326
|
-
};
|
|
54329
|
+
// var pcConfig = {
|
|
54330
|
+
// iceServers: config.webrtc.iceServers,
|
|
54331
|
+
// };
|
|
54332
|
+
const base = { iceServers: config.webrtc.iceServers };
|
|
54333
|
+
const extra = (typeof config.webrtc.iceTransportPolicy === 'undefined') ? {}
|
|
54334
|
+
: { iceTransportPolicy: config.webrtc.iceTransportPolicy };
|
|
54335
|
+
|
|
54336
|
+
const pcConfig = Object.assign({}, base, extra);
|
|
54327
54337
|
|
|
54328
54338
|
Helpers.trace("_reconnect peer configuration: " + JSON.stringify(pcConfig));
|
|
54329
54339
|
|
|
@@ -54571,7 +54581,26 @@ module.exports = WebRTCSignalingConstants;
|
|
|
54571
54581
|
* WebRTC Module (WebRTC signaling provider)
|
|
54572
54582
|
*/
|
|
54573
54583
|
|
|
54574
|
-
require('strophe.js');
|
|
54584
|
+
// require('strophe.js');
|
|
54585
|
+
// Try to load the UMD build that works with Node/CommonJS
|
|
54586
|
+
var __stropheMod;
|
|
54587
|
+
try {
|
|
54588
|
+
__stropheMod = require('strophe.js/dist/strophe.umd.js');
|
|
54589
|
+
} catch (e) {
|
|
54590
|
+
// Fallback: load default entry if the path above is not available
|
|
54591
|
+
__stropheMod = require('strophe.js');
|
|
54592
|
+
}
|
|
54593
|
+
|
|
54594
|
+
// Normalize possible export shapes
|
|
54595
|
+
// Strophe can be exported as { Strophe }, default, or the module itself
|
|
54596
|
+
var Strophe =
|
|
54597
|
+
(__stropheMod && (__stropheMod.Strophe || __stropheMod.default || __stropheMod)) || undefined;
|
|
54598
|
+
|
|
54599
|
+
// Basic guard: make sure the Connection class exists
|
|
54600
|
+
if (!Strophe || !Strophe.Connection) {
|
|
54601
|
+
throw new Error('[QBChat] Strophe import failed: Connection class not found');
|
|
54602
|
+
}
|
|
54603
|
+
// ---------------------------------------------------------------------------
|
|
54575
54604
|
|
|
54576
54605
|
var SignalingConstants = require('./qbWebRTCSignalingConstants');
|
|
54577
54606
|
|
|
@@ -54721,7 +54750,7 @@ function WebRTCSignalingProcessor(service, delegate) {
|
|
|
54721
54750
|
|
|
54722
54751
|
module.exports = WebRTCSignalingProcessor;
|
|
54723
54752
|
|
|
54724
|
-
},{"./qbWebRTCSignalingConstants":251,"strophe.js":211}],253:[function(require,module,exports){
|
|
54753
|
+
},{"./qbWebRTCSignalingConstants":251,"strophe.js":211,"strophe.js/dist/strophe.umd.js":211}],253:[function(require,module,exports){
|
|
54725
54754
|
'use strict';
|
|
54726
54755
|
|
|
54727
54756
|
/** JSHint inline rules */
|
|
@@ -54732,7 +54761,26 @@ module.exports = WebRTCSignalingProcessor;
|
|
|
54732
54761
|
* WebRTC Module (WebRTC signaling processor)
|
|
54733
54762
|
*/
|
|
54734
54763
|
|
|
54735
|
-
require('strophe.js');
|
|
54764
|
+
// require('strophe.js');
|
|
54765
|
+
// Try to load the UMD build that works with Node/CommonJS
|
|
54766
|
+
var __stropheMod;
|
|
54767
|
+
try {
|
|
54768
|
+
__stropheMod = require('strophe.js/dist/strophe.umd.js');
|
|
54769
|
+
} catch (e) {
|
|
54770
|
+
// Fallback: load default entry if the path above is not available
|
|
54771
|
+
__stropheMod = require('strophe.js');
|
|
54772
|
+
}
|
|
54773
|
+
|
|
54774
|
+
// Normalize possible export shapes
|
|
54775
|
+
// Strophe can be exported as { Strophe }, default, or the module itself
|
|
54776
|
+
var Strophe =
|
|
54777
|
+
(__stropheMod && (__stropheMod.Strophe || __stropheMod.default || __stropheMod)) || undefined;
|
|
54778
|
+
|
|
54779
|
+
// Basic guard: make sure the Connection class exists
|
|
54780
|
+
if (!Strophe || !Strophe.Connection) {
|
|
54781
|
+
throw new Error('[QBChat] Strophe import failed: Connection class not found');
|
|
54782
|
+
}
|
|
54783
|
+
// ---------------------------------------------------------------------------
|
|
54736
54784
|
|
|
54737
54785
|
var Helpers = require('./qbWebRTCHelpers');
|
|
54738
54786
|
var SignalingConstants = require('./qbWebRTCSignalingConstants');
|
|
@@ -54828,7 +54876,7 @@ WebRTCSignalingProvider.prototype._JStoXML = function (title, obj, msg) {
|
|
|
54828
54876
|
|
|
54829
54877
|
module.exports = WebRTCSignalingProvider;
|
|
54830
54878
|
|
|
54831
|
-
},{"../../qbConfig":255,"../../qbUtils":259,"./qbWebRTCHelpers":249,"./qbWebRTCSignalingConstants":251,"strophe.js":211}],254:[function(require,module,exports){
|
|
54879
|
+
},{"../../qbConfig":255,"../../qbUtils":259,"./qbWebRTCHelpers":249,"./qbWebRTCSignalingConstants":251,"strophe.js":211,"strophe.js/dist/strophe.umd.js":211}],254:[function(require,module,exports){
|
|
54832
54880
|
'use strict';
|
|
54833
54881
|
|
|
54834
54882
|
/**
|
|
@@ -55080,8 +55128,8 @@ module.exports = StreamManagement;
|
|
|
55080
55128
|
*/
|
|
55081
55129
|
|
|
55082
55130
|
var config = {
|
|
55083
|
-
version: '2.21.
|
|
55084
|
-
buildNumber: '
|
|
55131
|
+
version: '2.21.2',
|
|
55132
|
+
buildNumber: '1169',
|
|
55085
55133
|
creds: {
|
|
55086
55134
|
'appId': 0,
|
|
55087
55135
|
'authKey': '',
|
|
@@ -55115,6 +55163,12 @@ var config = {
|
|
|
55115
55163
|
dialingTimeInterval: 5,
|
|
55116
55164
|
disconnectTimeInterval: 30,
|
|
55117
55165
|
statsReportTimeInterval: false,
|
|
55166
|
+
/**
|
|
55167
|
+
* ICE transport policy.
|
|
55168
|
+
* If undefined -> do not pass this option into RTCPeerConnection.
|
|
55169
|
+
* Allowed values when set: "all" | "relay".
|
|
55170
|
+
*/
|
|
55171
|
+
iceTransportPolicy: undefined,
|
|
55118
55172
|
iceServers: [
|
|
55119
55173
|
{
|
|
55120
55174
|
urls: ['turn:turn.quickblox.com', 'stun:turn.quickblox.com'],
|
|
@@ -55153,33 +55207,49 @@ var config = {
|
|
|
55153
55207
|
callBackInterval: 30,
|
|
55154
55208
|
};
|
|
55155
55209
|
|
|
55156
|
-
config.set = function(options) {
|
|
55157
|
-
|
|
55158
|
-
|
|
55159
|
-
|
|
55160
|
-
|
|
55161
|
-
|
|
55162
|
-
|
|
55163
|
-
Object.keys(options).forEach(function(key) {
|
|
55164
|
-
if(key !== 'set' && config.hasOwnProperty(key)) {
|
|
55165
|
-
if(typeof options[key] !== 'object') {
|
|
55166
|
-
config[key] = options[key];
|
|
55167
|
-
} else {
|
|
55168
|
-
Object.keys(options[key]).forEach(function(nextkey) {
|
|
55169
|
-
if(config[key].hasOwnProperty(nextkey)){
|
|
55170
|
-
config[key][nextkey] = options[key][nextkey];
|
|
55171
|
-
}
|
|
55172
|
-
});
|
|
55173
|
-
}
|
|
55210
|
+
config.set = function (options) {
|
|
55211
|
+
// Update chat endpoints (same behavior as before)
|
|
55212
|
+
if (typeof options.endpoints === 'object' && options.endpoints.chat) {
|
|
55213
|
+
config.endpoints.muc = 'muc.' + options.endpoints.chat;
|
|
55214
|
+
config.chatProtocol.bosh = 'https://' + options.endpoints.chat + ':5281';
|
|
55215
|
+
config.chatProtocol.websocket = 'wss://' + options.endpoints.chat + ':5291';
|
|
55174
55216
|
}
|
|
55175
55217
|
|
|
55176
|
-
//
|
|
55177
|
-
|
|
55178
|
-
|
|
55179
|
-
|
|
55180
|
-
|
|
55218
|
+
// Shallow merge: copy only known keys; skip undefined values
|
|
55219
|
+
Object.keys(options).forEach(function (key) {
|
|
55220
|
+
if (key !== 'set' && Object.prototype.hasOwnProperty.call(config, key)) {
|
|
55221
|
+
if (typeof options[key] !== 'object' || options[key] === null) {
|
|
55222
|
+
// Primitive or null: assign as is
|
|
55223
|
+
if (typeof options[key] !== 'undefined') {
|
|
55224
|
+
config[key] = options[key];
|
|
55225
|
+
}
|
|
55226
|
+
} else {
|
|
55227
|
+
// Object: copy only known subkeys; skip undefined values
|
|
55228
|
+
Object.keys(options[key]).forEach(function (nextkey) {
|
|
55229
|
+
if (
|
|
55230
|
+
Object.prototype.hasOwnProperty.call(config[key], nextkey) &&
|
|
55231
|
+
typeof options[key][nextkey] !== 'undefined'
|
|
55232
|
+
) {
|
|
55233
|
+
config[key][nextkey] = options[key][nextkey];
|
|
55234
|
+
}
|
|
55235
|
+
});
|
|
55236
|
+
}
|
|
55237
|
+
}
|
|
55238
|
+
|
|
55239
|
+
// Backward compatibility: allow top-level iceServers
|
|
55240
|
+
if (key === 'iceServers' && typeof options[key] !== 'undefined') {
|
|
55241
|
+
config.webrtc.iceServers = options[key];
|
|
55242
|
+
}
|
|
55243
|
+
|
|
55244
|
+
// Backward compatibility: allow top-level iceTransportPolicy
|
|
55245
|
+
if (key === 'iceTransportPolicy' && typeof options[key] !== 'undefined') {
|
|
55246
|
+
// Allowed values when set: "all" | "relay"
|
|
55247
|
+
config.webrtc.iceTransportPolicy = options[key];
|
|
55248
|
+
}
|
|
55249
|
+
});
|
|
55181
55250
|
};
|
|
55182
55251
|
|
|
55252
|
+
|
|
55183
55253
|
config.updateSessionExpirationDate = function (tokenExpirationDate, headerHasToken = false) {
|
|
55184
55254
|
var connectionTimeLag = 1; // minute
|
|
55185
55255
|
var newDate;
|
|
@@ -55210,11 +55280,11 @@ module.exports = config;
|
|
|
55210
55280
|
*/
|
|
55211
55281
|
var config = require('./qbConfig');
|
|
55212
55282
|
var Utils = require('./qbUtils');
|
|
55213
|
-
const MessageProxy = require("./modules/chat/qbMessage");
|
|
55214
|
-
const Chat = require("./modules/chat/qbChat");
|
|
55215
|
-
const DialogProxy = require("./modules/chat/qbDialog");
|
|
55216
|
-
const WebRTCClient = require("./modules/webrtc/qbWebRTCClient");
|
|
55217
|
-
const PushNotifications = require("./modules/qbPushNotifications");
|
|
55283
|
+
// const MessageProxy = require("./modules/chat/qbMessage");
|
|
55284
|
+
// const Chat = require("./modules/chat/qbChat");
|
|
55285
|
+
// const DialogProxy = require("./modules/chat/qbDialog");
|
|
55286
|
+
// const WebRTCClient = require("./modules/webrtc/qbWebRTCClient");
|
|
55287
|
+
// const PushNotifications = require("./modules/qbPushNotifications");
|
|
55218
55288
|
|
|
55219
55289
|
// Actual QuickBlox API starts here
|
|
55220
55290
|
function QuickBlox() {}
|
|
@@ -55970,12 +56040,36 @@ module.exports = ServiceProxy;
|
|
|
55970
56040
|
* Strophe Connection Object
|
|
55971
56041
|
*/
|
|
55972
56042
|
|
|
55973
|
-
require('strophe.js');
|
|
56043
|
+
// require('strophe.js');
|
|
56044
|
+
|
|
56045
|
+
// ---- Strophe import (UMD-first with safe fallback) -------------------------
|
|
56046
|
+
// Try to load the UMD build that works with Node/CommonJS
|
|
56047
|
+
var __stropheMod;
|
|
56048
|
+
try {
|
|
56049
|
+
__stropheMod = require('strophe.js/dist/strophe.umd.js');
|
|
56050
|
+
} catch (e) {
|
|
56051
|
+
// Fallback: load default entry if the path above is not available
|
|
56052
|
+
__stropheMod = require('strophe.js');
|
|
56053
|
+
}
|
|
56054
|
+
|
|
56055
|
+
// Normalize possible export shapes
|
|
56056
|
+
// Strophe can be exported as { Strophe }, default, or the module itself
|
|
56057
|
+
var Strophe =
|
|
56058
|
+
(__stropheMod && (__stropheMod.Strophe || __stropheMod.default || __stropheMod)) || undefined;
|
|
56059
|
+
|
|
56060
|
+
// Basic guard: make sure the Connection class exists
|
|
56061
|
+
if (!Strophe || !Strophe.Connection) {
|
|
56062
|
+
throw new Error('[QBChat] Strophe import failed: Connection class not found');
|
|
56063
|
+
}
|
|
56064
|
+
// ---------------------------------------------------------------------------
|
|
55974
56065
|
|
|
55975
56066
|
var config = require('./qbConfig');
|
|
55976
56067
|
var chatPRTCL = config.chatProtocol;
|
|
55977
56068
|
var Utils = require('./qbUtils');
|
|
55978
56069
|
|
|
56070
|
+
|
|
56071
|
+
|
|
56072
|
+
|
|
55979
56073
|
function Connection(onLogListenerCallback) {
|
|
55980
56074
|
var protocol = chatPRTCL.active === 1 ? chatPRTCL.bosh : chatPRTCL.websocket;
|
|
55981
56075
|
var conn = new Strophe.Connection(protocol);
|
|
@@ -56039,7 +56133,7 @@ function Connection(onLogListenerCallback) {
|
|
|
56039
56133
|
|
|
56040
56134
|
module.exports = Connection;
|
|
56041
56135
|
|
|
56042
|
-
},{"./qbConfig":255,"./qbUtils":259,"strophe.js":211}],259:[function(require,module,exports){
|
|
56136
|
+
},{"./qbConfig":255,"./qbUtils":259,"strophe.js":211,"strophe.js/dist/strophe.umd.js":211}],259:[function(require,module,exports){
|
|
56043
56137
|
(function (global){(function (){
|
|
56044
56138
|
/* eslint no-console: 2 */
|
|
56045
56139
|
|
|
@@ -901,9 +901,14 @@ WebRTCSession.prototype._createPeer = function (userId, polite) {
|
|
|
901
901
|
|
|
902
902
|
this.startCallTime = new Date();
|
|
903
903
|
|
|
904
|
-
var pcConfig = {
|
|
905
|
-
|
|
906
|
-
};
|
|
904
|
+
// var pcConfig = {
|
|
905
|
+
// iceServers: config.webrtc.iceServers,
|
|
906
|
+
// };
|
|
907
|
+
const base = { iceServers: config.webrtc.iceServers };
|
|
908
|
+
const extra = (typeof config.webrtc.iceTransportPolicy === 'undefined') ? {}
|
|
909
|
+
: { iceTransportPolicy: config.webrtc.iceTransportPolicy };
|
|
910
|
+
|
|
911
|
+
const pcConfig = Object.assign({}, base, extra);
|
|
907
912
|
|
|
908
913
|
Helpers.trace("_createPeer configuration: " + JSON.stringify(pcConfig));
|
|
909
914
|
|
|
@@ -1068,9 +1073,14 @@ WebRTCSession.prototype._reconnect = function (peerConnection, negotiate) {
|
|
|
1068
1073
|
|
|
1069
1074
|
peerConnection.release();
|
|
1070
1075
|
|
|
1071
|
-
var pcConfig = {
|
|
1072
|
-
|
|
1073
|
-
};
|
|
1076
|
+
// var pcConfig = {
|
|
1077
|
+
// iceServers: config.webrtc.iceServers,
|
|
1078
|
+
// };
|
|
1079
|
+
const base = { iceServers: config.webrtc.iceServers };
|
|
1080
|
+
const extra = (typeof config.webrtc.iceTransportPolicy === 'undefined') ? {}
|
|
1081
|
+
: { iceTransportPolicy: config.webrtc.iceTransportPolicy };
|
|
1082
|
+
|
|
1083
|
+
const pcConfig = Object.assign({}, base, extra);
|
|
1074
1084
|
|
|
1075
1085
|
Helpers.trace("_reconnect peer configuration: " + JSON.stringify(pcConfig));
|
|
1076
1086
|
|
|
@@ -5,7 +5,26 @@
|
|
|
5
5
|
* WebRTC Module (WebRTC signaling provider)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
require('strophe.js');
|
|
8
|
+
// require('strophe.js');
|
|
9
|
+
// Try to load the UMD build that works with Node/CommonJS
|
|
10
|
+
var __stropheMod;
|
|
11
|
+
try {
|
|
12
|
+
__stropheMod = require('strophe.js/dist/strophe.umd.js');
|
|
13
|
+
} catch (e) {
|
|
14
|
+
// Fallback: load default entry if the path above is not available
|
|
15
|
+
__stropheMod = require('strophe.js');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Normalize possible export shapes
|
|
19
|
+
// Strophe can be exported as { Strophe }, default, or the module itself
|
|
20
|
+
var Strophe =
|
|
21
|
+
(__stropheMod && (__stropheMod.Strophe || __stropheMod.default || __stropheMod)) || undefined;
|
|
22
|
+
|
|
23
|
+
// Basic guard: make sure the Connection class exists
|
|
24
|
+
if (!Strophe || !Strophe.Connection) {
|
|
25
|
+
throw new Error('[QBChat] Strophe import failed: Connection class not found');
|
|
26
|
+
}
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
9
28
|
|
|
10
29
|
var SignalingConstants = require('./qbWebRTCSignalingConstants');
|
|
11
30
|
|
|
@@ -8,7 +8,26 @@
|
|
|
8
8
|
* WebRTC Module (WebRTC signaling processor)
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
require('strophe.js');
|
|
11
|
+
// require('strophe.js');
|
|
12
|
+
// Try to load the UMD build that works with Node/CommonJS
|
|
13
|
+
var __stropheMod;
|
|
14
|
+
try {
|
|
15
|
+
__stropheMod = require('strophe.js/dist/strophe.umd.js');
|
|
16
|
+
} catch (e) {
|
|
17
|
+
// Fallback: load default entry if the path above is not available
|
|
18
|
+
__stropheMod = require('strophe.js');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Normalize possible export shapes
|
|
22
|
+
// Strophe can be exported as { Strophe }, default, or the module itself
|
|
23
|
+
var Strophe =
|
|
24
|
+
(__stropheMod && (__stropheMod.Strophe || __stropheMod.default || __stropheMod)) || undefined;
|
|
25
|
+
|
|
26
|
+
// Basic guard: make sure the Connection class exists
|
|
27
|
+
if (!Strophe || !Strophe.Connection) {
|
|
28
|
+
throw new Error('[QBChat] Strophe import failed: Connection class not found');
|
|
29
|
+
}
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
12
31
|
|
|
13
32
|
var Helpers = require('./qbWebRTCHelpers');
|
|
14
33
|
var SignalingConstants = require('./qbWebRTCSignalingConstants');
|
package/src/qbConfig.js
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
var config = {
|
|
15
|
-
version: '2.21.
|
|
16
|
-
buildNumber: '
|
|
15
|
+
version: '2.21.2',
|
|
16
|
+
buildNumber: '1169',
|
|
17
17
|
creds: {
|
|
18
18
|
'appId': 0,
|
|
19
19
|
'authKey': '',
|
|
@@ -47,6 +47,12 @@ var config = {
|
|
|
47
47
|
dialingTimeInterval: 5,
|
|
48
48
|
disconnectTimeInterval: 30,
|
|
49
49
|
statsReportTimeInterval: false,
|
|
50
|
+
/**
|
|
51
|
+
* ICE transport policy.
|
|
52
|
+
* If undefined -> do not pass this option into RTCPeerConnection.
|
|
53
|
+
* Allowed values when set: "all" | "relay".
|
|
54
|
+
*/
|
|
55
|
+
iceTransportPolicy: undefined,
|
|
50
56
|
iceServers: [
|
|
51
57
|
{
|
|
52
58
|
urls: ['turn:turn.quickblox.com', 'stun:turn.quickblox.com'],
|
|
@@ -85,33 +91,49 @@ var config = {
|
|
|
85
91
|
callBackInterval: 30,
|
|
86
92
|
};
|
|
87
93
|
|
|
88
|
-
config.set = function(options) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
Object.keys(options).forEach(function(key) {
|
|
96
|
-
if(key !== 'set' && config.hasOwnProperty(key)) {
|
|
97
|
-
if(typeof options[key] !== 'object') {
|
|
98
|
-
config[key] = options[key];
|
|
99
|
-
} else {
|
|
100
|
-
Object.keys(options[key]).forEach(function(nextkey) {
|
|
101
|
-
if(config[key].hasOwnProperty(nextkey)){
|
|
102
|
-
config[key][nextkey] = options[key][nextkey];
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
94
|
+
config.set = function (options) {
|
|
95
|
+
// Update chat endpoints (same behavior as before)
|
|
96
|
+
if (typeof options.endpoints === 'object' && options.endpoints.chat) {
|
|
97
|
+
config.endpoints.muc = 'muc.' + options.endpoints.chat;
|
|
98
|
+
config.chatProtocol.bosh = 'https://' + options.endpoints.chat + ':5281';
|
|
99
|
+
config.chatProtocol.websocket = 'wss://' + options.endpoints.chat + ':5291';
|
|
106
100
|
}
|
|
107
101
|
|
|
108
|
-
//
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
102
|
+
// Shallow merge: copy only known keys; skip undefined values
|
|
103
|
+
Object.keys(options).forEach(function (key) {
|
|
104
|
+
if (key !== 'set' && Object.prototype.hasOwnProperty.call(config, key)) {
|
|
105
|
+
if (typeof options[key] !== 'object' || options[key] === null) {
|
|
106
|
+
// Primitive or null: assign as is
|
|
107
|
+
if (typeof options[key] !== 'undefined') {
|
|
108
|
+
config[key] = options[key];
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
// Object: copy only known subkeys; skip undefined values
|
|
112
|
+
Object.keys(options[key]).forEach(function (nextkey) {
|
|
113
|
+
if (
|
|
114
|
+
Object.prototype.hasOwnProperty.call(config[key], nextkey) &&
|
|
115
|
+
typeof options[key][nextkey] !== 'undefined'
|
|
116
|
+
) {
|
|
117
|
+
config[key][nextkey] = options[key][nextkey];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Backward compatibility: allow top-level iceServers
|
|
124
|
+
if (key === 'iceServers' && typeof options[key] !== 'undefined') {
|
|
125
|
+
config.webrtc.iceServers = options[key];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Backward compatibility: allow top-level iceTransportPolicy
|
|
129
|
+
if (key === 'iceTransportPolicy' && typeof options[key] !== 'undefined') {
|
|
130
|
+
// Allowed values when set: "all" | "relay"
|
|
131
|
+
config.webrtc.iceTransportPolicy = options[key];
|
|
132
|
+
}
|
|
133
|
+
});
|
|
113
134
|
};
|
|
114
135
|
|
|
136
|
+
|
|
115
137
|
config.updateSessionExpirationDate = function (tokenExpirationDate, headerHasToken = false) {
|
|
116
138
|
var connectionTimeLag = 1; // minute
|
|
117
139
|
var newDate;
|
package/src/qbMain.js
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var config = require('./qbConfig');
|
|
10
10
|
var Utils = require('./qbUtils');
|
|
11
|
-
const MessageProxy = require("./modules/chat/qbMessage");
|
|
12
|
-
const Chat = require("./modules/chat/qbChat");
|
|
13
|
-
const DialogProxy = require("./modules/chat/qbDialog");
|
|
14
|
-
const WebRTCClient = require("./modules/webrtc/qbWebRTCClient");
|
|
15
|
-
const PushNotifications = require("./modules/qbPushNotifications");
|
|
11
|
+
// const MessageProxy = require("./modules/chat/qbMessage");
|
|
12
|
+
// const Chat = require("./modules/chat/qbChat");
|
|
13
|
+
// const DialogProxy = require("./modules/chat/qbDialog");
|
|
14
|
+
// const WebRTCClient = require("./modules/webrtc/qbWebRTCClient");
|
|
15
|
+
// const PushNotifications = require("./modules/qbPushNotifications");
|
|
16
16
|
|
|
17
17
|
// Actual QuickBlox API starts here
|
|
18
18
|
function QuickBlox() {}
|
package/src/qbStrophe.js
CHANGED
|
@@ -7,12 +7,36 @@
|
|
|
7
7
|
* Strophe Connection Object
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
require('strophe.js');
|
|
10
|
+
// require('strophe.js');
|
|
11
|
+
|
|
12
|
+
// ---- Strophe import (UMD-first with safe fallback) -------------------------
|
|
13
|
+
// Try to load the UMD build that works with Node/CommonJS
|
|
14
|
+
var __stropheMod;
|
|
15
|
+
try {
|
|
16
|
+
__stropheMod = require('strophe.js/dist/strophe.umd.js');
|
|
17
|
+
} catch (e) {
|
|
18
|
+
// Fallback: load default entry if the path above is not available
|
|
19
|
+
__stropheMod = require('strophe.js');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Normalize possible export shapes
|
|
23
|
+
// Strophe can be exported as { Strophe }, default, or the module itself
|
|
24
|
+
var Strophe =
|
|
25
|
+
(__stropheMod && (__stropheMod.Strophe || __stropheMod.default || __stropheMod)) || undefined;
|
|
26
|
+
|
|
27
|
+
// Basic guard: make sure the Connection class exists
|
|
28
|
+
if (!Strophe || !Strophe.Connection) {
|
|
29
|
+
throw new Error('[QBChat] Strophe import failed: Connection class not found');
|
|
30
|
+
}
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
11
32
|
|
|
12
33
|
var config = require('./qbConfig');
|
|
13
34
|
var chatPRTCL = config.chatProtocol;
|
|
14
35
|
var Utils = require('./qbUtils');
|
|
15
36
|
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
16
40
|
function Connection(onLogListenerCallback) {
|
|
17
41
|
var protocol = chatPRTCL.active === 1 ? chatPRTCL.bosh : chatPRTCL.websocket;
|
|
18
42
|
var conn = new Strophe.Connection(protocol);
|