quickblox 2.13.8 → 2.13.11

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 CHANGED
@@ -16,7 +16,7 @@ Check out our [API Reference](https://quickblox.github.io/quickblox-javascript-s
16
16
  ## Dependencies for browser
17
17
 
18
18
  ```html
19
- <script src="https://unpkg.com/quickblox@2.13.7/quickblox.min.js"></script>
19
+ <script src="https://unpkg.com/quickblox@2.13.11/quickblox.min.js"></script>
20
20
  ```
21
21
 
22
22
  ## Bower and RequireJS
@@ -40,10 +40,10 @@ npm install quickblox --save
40
40
  And you're ready to go:
41
41
 
42
42
  ```javascript
43
- var QB = require('quickblox');
43
+ var QB = require("quickblox");
44
44
 
45
45
  // OR to create many QB instances
46
- var QuickBlox = require('quickblox').QuickBlox;
46
+ var QuickBlox = require("quickblox").QuickBlox;
47
47
  var QB1 = new QuickBlox();
48
48
  var QB2 = new QuickBlox();
49
49
  ```
@@ -54,9 +54,9 @@ var QB2 = new QuickBlox();
54
54
 
55
55
  # Browsers support
56
56
 
57
- | Edge | Firefox | Chrome | Safari | Opera | Node.js |
58
- |:----:|:-------:|:------:|:------:|:-----:|:-------:|
59
- | 14+ | 52+ | 50+ | 11.1+ | 36+ | 6+ |
57
+ | Edge | Firefox | Chrome | Safari | Opera | Node.js |
58
+ | :--: | :-----: | :----: | :----: | :---: | :-----: |
59
+ | 14+ | 52+ | 50+ | 11.1+ | 36+ | 6+ |
60
60
 
61
61
  # Documentation
62
62
 
@@ -69,7 +69,9 @@ Please raise questions, requests for help etc. via https://stackoverflow.com/que
69
69
  Feedback and suggestions for improvement always welcome :)
70
70
 
71
71
  # How to contribute
72
+
72
73
  See more information at [contributing.md](https://github.com/QuickBlox/quickblox-javascript-sdk/blob/gh-pages/.github/CONTRIBUTING.md)
73
74
 
74
75
  # License
76
+
75
77
  Apache 2.0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quickblox",
3
3
  "description": "QuickBlox JavaScript SDK",
4
- "version": "2.13.8",
4
+ "version": "2.13.11",
5
5
  "homepage": "https://quickblox.com/developers/Javascript",
6
6
  "main": "src/qbMain.js",
7
7
  "license": "(Apache-2.0)",
@@ -76,6 +76,7 @@
76
76
  }
77
77
  },
78
78
  "scripts": {
79
+ "dev": "NODE_ENV=develop gulp watch",
79
80
  "setDependencies": "npm i && npm i -g gulp-cli && npm install rimraf -g && npm install -g jasmine",
80
81
  "lint": "jshint src --reporter=node_modules/jshint-stylish",
81
82
  "build": "cross-env NODE_ENV=production npm run lint && gulp build && gulp minify",
package/quickblox.js CHANGED
@@ -46856,7 +46856,7 @@ ChatProxy.prototype = {
46856
46856
  case Strophe.Status.AUTHFAIL:
46857
46857
  self.isConnected = false;
46858
46858
  self._isConnecting = false;
46859
-
46859
+
46860
46860
  err = Utils.getError(401, 'Status.AUTHFAIL - The authentication attempt failed', 'QBChat');
46861
46861
 
46862
46862
  if (isInitialConnect) {
@@ -47200,10 +47200,12 @@ ChatProxy.prototype = {
47200
47200
  xmlns: chatUtils.MARKERS.STATES
47201
47201
  });
47202
47202
 
47203
- if(Utils.getEnv().browser){
47204
- self.connection.send(stanza);
47205
- } else {
47206
- self.Client.send(stanza);
47203
+ if (self.connection.connected) {
47204
+ if(Utils.getEnv().browser){
47205
+ self.connection.send(stanza);
47206
+ } else {
47207
+ self.Client.send(stanza);
47208
+ }
47207
47209
  }
47208
47210
  },
47209
47211
 
@@ -47227,10 +47229,12 @@ ChatProxy.prototype = {
47227
47229
  xmlns: chatUtils.MARKERS.STATES
47228
47230
  });
47229
47231
 
47230
- if(Utils.getEnv().browser){
47231
- self.connection.send(stanza);
47232
- } else {
47233
- self.Client.send(stanza);
47232
+ if (self.connection.connected) {
47233
+ if(Utils.getEnv().browser){
47234
+ self.connection.send(stanza);
47235
+ } else {
47236
+ self.Client.send(stanza);
47237
+ }
47234
47238
  }
47235
47239
  },
47236
47240
 
@@ -51141,48 +51145,31 @@ RTCPeerConnection.prototype.getAndSetLocalSessionDescription = function(callType
51141
51145
 
51142
51146
  self.state = RTCPeerConnection.State.CONNECTING;
51143
51147
 
51144
- if (self.type === 'offer') {
51145
- // Additional parameters for SDP Constraints
51146
- // http://www.w3.org/TR/webrtc/#h-offer-answer-options
51147
-
51148
- self.createOffer().then(function(offer) {
51149
- if (self.delegate.bandwidth) {
51150
- offer.sdp = setMediaBitrate(
51151
- offer.sdp,
51152
- 'video',
51153
- self.delegate.bandwidth
51154
- );
51155
- }
51156
- successCallback(offer);
51157
- }).catch(function(reason) {
51158
- errorCallback(reason);
51159
- });
51160
-
51161
- } else {
51162
- self.createAnswer().then(function(answer) {
51163
- if (self.delegate.bandwidth) {
51164
- answer.sdp = setMediaBitrate(
51165
- answer.sdp,
51166
- 'video',
51167
- self.delegate.bandwidth
51168
- );
51169
- }
51170
- successCallback(answer);
51171
- }).catch(function(reason) {
51172
- errorCallback(reason);
51173
- });
51174
- }
51175
-
51176
- function successCallback(desc) {
51177
- self.setLocalDescription(desc).then(function() {
51178
- callback(null);
51179
- }).catch(function(error) {
51180
- errorCallback(error);
51181
- });
51148
+ /**
51149
+ * @param {RTCSessionDescriptionInit} description
51150
+ */
51151
+ function successCallback(description) {
51152
+ var modifiedDescription = _removeExtmapMixedFromSDP(description);
51153
+ if (self.delegate.bandwidth) {
51154
+ modifiedDescription.sdp = setMediaBitrate(
51155
+ modifiedDescription.sdp,
51156
+ 'video',
51157
+ self.delegate.bandwidth
51158
+ );
51159
+ }
51160
+ self.setLocalDescription(modifiedDescription)
51161
+ .then(function() {
51162
+ callback(null);
51163
+ })
51164
+ .catch(function(error) {
51165
+ callback(error);
51166
+ });
51182
51167
  }
51183
51168
 
51184
- function errorCallback(error) {
51185
- callback(error);
51169
+ if (self.type === 'offer') {
51170
+ self.createOffer().then(successCallback).catch(callback);
51171
+ } else {
51172
+ self.createAnswer().then(successCallback).catch(callback);
51186
51173
  }
51187
51174
  };
51188
51175
 
@@ -51561,19 +51548,21 @@ function _getStats(peer, lastResults, successCallback, errorCallback) {
51561
51548
  }
51562
51549
 
51563
51550
  /**
51564
- * It's functions to fixed issue
51565
- * https://bugzilla.mozilla.org/show_bug.cgi?id=1377434
51551
+ * This is to fix error on legacy WebRTC implementations
51552
+ * @param {RTCSessionDescriptionInit} description
51566
51553
  */
51567
- function _modifySDPforFixIssue(sdp) {
51568
- var parsedSDP = transform.parse(sdp);
51569
-
51570
- parsedSDP.groups = parsedSDP.groups ? parsedSDP.groups : [];
51571
- parsedSDP.groups.push({
51572
- mids: 'sdparta_0',
51573
- type: 'BUNDLE'
51574
- });
51575
-
51576
- return transform.write(parsedSDP);
51554
+ function _removeExtmapMixedFromSDP(description) {
51555
+ if (description &&
51556
+ description.sdp &&
51557
+ description.sdp.indexOf('\na=extmap-allow-mixed') !== -1) {
51558
+ description.sdp = description.sdp
51559
+ .split('\n')
51560
+ .filter(function (line) {
51561
+ return line.trim() !== 'a=extmap-allow-mixed';
51562
+ })
51563
+ .join('\n');
51564
+ }
51565
+ return description;
51577
51566
  }
51578
51567
 
51579
51568
  function setMediaBitrate(sdp, media, bitrate) {
@@ -51804,6 +51793,14 @@ WebRTCClient.prototype.getNewSessionsCount = function (exceptId) {
51804
51793
  WebRTCClient.prototype._onCallListener = function(userID, sessionID, extension) {
51805
51794
  var userInfo = extension.userInfo || {};
51806
51795
 
51796
+ var currentUserID = Helpers.getIdFromNode(this.connection.jid);
51797
+ if (userID === currentUserID && !extension.opponentsIDs.includes(currentUserID)) {
51798
+ Helpers.trace(
51799
+ 'Ignore "onCall" signal from current user.' +
51800
+ ' userID:' + userID + ', sessionID: ' + sessionID
51801
+ );
51802
+ return;
51803
+ }
51807
51804
  Helpers.trace("onCall. UserID:" + userID + ". SessionID: " + sessionID);
51808
51805
 
51809
51806
  var otherActiveSessions = this.isExistNewOrActiveSessionExceptSessionID(sessionID);
@@ -52754,14 +52751,17 @@ WebRTCSession.prototype.processOnAccept = function(userID, extension) {
52754
52751
 
52755
52752
  if(peerConnection){
52756
52753
  peerConnection._clearDialingTimer();
52757
-
52758
- peerConnection.setRemoteSessionDescription('answer', extension.sdp, function(error){
52759
- if(error){
52760
- Helpers.traceError("'setRemoteSessionDescription' error: " + error);
52761
- }else{
52762
- Helpers.trace("'setRemoteSessionDescription' success");
52763
- }
52764
- });
52754
+ if (peerConnection.signalingState !== 'stable') {
52755
+ peerConnection.setRemoteSessionDescription('answer', extension.sdp, function(error){
52756
+ if(error){
52757
+ Helpers.traceError("'setRemoteSessionDescription' error: " + error);
52758
+ }else{
52759
+ Helpers.trace("'setRemoteSessionDescription' success");
52760
+ }
52761
+ });
52762
+ } else {
52763
+ Helpers.traceError("Ignore 'onAccept', PeerConnection is already in 'stable' state");
52764
+ }
52765
52765
  }else{
52766
52766
  Helpers.traceError("Ignore 'OnAccept', there is no information about peer connection by some reason.");
52767
52767
  }
@@ -52902,7 +52902,6 @@ WebRTCSession.prototype._createPeer = function(userID, peerConnectionType) {
52902
52902
 
52903
52903
  var pcConfig = {
52904
52904
  iceServers: config.webrtc.iceServers,
52905
- offerExtmapAllowMixed: false
52906
52905
  };
52907
52906
 
52908
52907
  Helpers.trace("_createPeer, iceServers: " + JSON.stringify(pcConfig));
@@ -53459,6 +53458,8 @@ function StreamManagement(options) {
53459
53458
  // The client send stanza counter.
53460
53459
  this._clientSentStanzasCounter = null;
53461
53460
 
53461
+ this._intervalId = null;
53462
+
53462
53463
  this._timeInterval = 2000;
53463
53464
 
53464
53465
  this.sentMessageCallback = null;
@@ -53543,7 +53544,12 @@ StreamManagement.prototype._addEnableHandlers = function () {
53543
53544
  if(tagName === 'enabled'){
53544
53545
  self._isStreamManagementEnabled = true;
53545
53546
 
53546
- setInterval(self._timeoutCallback.bind(self), self._timeInterval);
53547
+ return true;
53548
+ }
53549
+
53550
+ if (self._isStreamManagementEnabled && tagName === 'message') {
53551
+ clearInterval(self._intervalId);
53552
+ self._intervalId = setInterval(self._timeoutCallback.bind(self), self._timeInterval);
53547
53553
 
53548
53554
  return true;
53549
53555
  }
@@ -53583,17 +53589,22 @@ StreamManagement.prototype.send = function (stanza, message) {
53583
53589
  bodyContent = chatUtils.getElementText(stanzaXML, 'body') || '',
53584
53590
  attachments = chatUtils.getAllElements(stanzaXML, 'attachment') || '';
53585
53591
 
53586
- self._originalSend.call(self._c, stanza);
53587
-
53588
- if (tagName === 'message' && (type === 'chat' || type === 'groupchat') && (bodyContent || attachments.length)) {
53589
- self._sendStanzasRequest({
53590
- message: message,
53591
- time: Date.now() + self._timeInterval,
53592
- expect: self._clientSentStanzasCounter
53593
- });
53592
+ try {
53593
+ self._originalSend.call(self._c, stanza);
53594
+ } catch (e) {
53595
+ Utils.QBLog('[QBChat]', e.message);
53596
+ } finally {
53597
+ if (tagName === 'message' && (type === 'chat' || type === 'groupchat') && (bodyContent || attachments.length)) {
53598
+ self._sendStanzasRequest({
53599
+ message: message,
53600
+ time: Date.now() + self._timeInterval,
53601
+ expect: self._clientSentStanzasCounter
53602
+ });
53603
+ }
53604
+
53605
+ self._clientSentStanzasCounter++;
53594
53606
  }
53595
53607
 
53596
- self._clientSentStanzasCounter++;
53597
53608
  };
53598
53609
 
53599
53610
  StreamManagement.prototype._sendStanzasRequest = function (data) {
@@ -53602,10 +53613,14 @@ StreamManagement.prototype._sendStanzasRequest = function (data) {
53602
53613
  if(self._isStreamManagementEnabled){
53603
53614
  self._stanzasQueue.push(data);
53604
53615
 
53605
- var stanza = Utils.getEnv().browser ? $build('r', { xmlns: self._NS}) :
53606
- chatUtils.createStanza(self._nodeBuilder, { xmlns: self._NS}, 'r');
53616
+ var stanza = Utils.getEnv().browser ? $build('r', { xmlns: self._NS }) :
53617
+ chatUtils.createStanza(self._nodeBuilder, { xmlns: self._NS }, 'r');
53607
53618
 
53608
- self._originalSend.call(self._c, stanza);
53619
+ if (self._c.connected) {
53620
+ self._originalSend.call(self._c, stanza);
53621
+ } else {
53622
+ self._checkCounterOnIncomeStanza();
53623
+ }
53609
53624
  }
53610
53625
  };
53611
53626
 
@@ -53614,13 +53629,15 @@ StreamManagement.prototype.getClientSentStanzasCounter = function(){
53614
53629
  };
53615
53630
 
53616
53631
  StreamManagement.prototype._checkCounterOnIncomeStanza = function (count){
53617
- if (this._stanzasQueue[0].expect !== count){
53618
- this.sentMessageCallback(this._stanzasQueue[0].message);
53619
- } else {
53620
- this.sentMessageCallback(null, this._stanzasQueue[0].message);
53632
+ if (this._stanzasQueue.length) {
53633
+ if (this._stanzasQueue[0].expect !== count){
53634
+ this.sentMessageCallback(this._stanzasQueue[0].message);
53635
+ } else {
53636
+ this.sentMessageCallback(null, this._stanzasQueue[0].message);
53637
+ }
53638
+
53639
+ this._stanzasQueue.shift();
53621
53640
  }
53622
-
53623
- this._stanzasQueue.shift();
53624
53641
  };
53625
53642
 
53626
53643
  StreamManagement.prototype._increaseReceivedStanzasCounter = function(){
@@ -53644,8 +53661,8 @@ module.exports = StreamManagement;
53644
53661
  */
53645
53662
 
53646
53663
  var config = {
53647
- version: '2.13.8',
53648
- buildNumber: '1101',
53664
+ version: '2.13.11',
53665
+ buildNumber: '1105',
53649
53666
  creds: {
53650
53667
  appId: '',
53651
53668
  authKey: '',