Browse Source

feat: Adds debug log around connected.

With visitors we rarely see not able to send messages or presence because not connected error.
Seems the status of the connection is wrong when quickly disconnecting and connecting again.
master
damencho 2 years ago
parent
commit
cf2914ddfc
2 changed files with 4 additions and 1 deletions
  1. 3
    0
      modules/xmpp/XmppConnection.js
  2. 1
    1
      modules/xmpp/xmpp.js

+ 3
- 0
modules/xmpp/XmppConnection.js View File

@@ -495,6 +495,9 @@ export default class XmppConnection extends Listenable {
495 495
      */
496 496
     send(stanza) {
497 497
         if (!this.connected) {
498
+            logger.error(`Trying to send stanza while not connected. Status:${this._status} Proto:${
499
+                this.isUsingWebSocket ? this._stropheConn?._proto?.socket?.readyState : 'bosh'
500
+            }`);
498 501
             throw new Error('Not connected');
499 502
         }
500 503
         this._stropheConn.send(stanza);

+ 1
- 1
modules/xmpp/xmpp.js View File

@@ -795,8 +795,8 @@ export default class XMPP extends Listenable {
795 795
         this.disconnectInProgress = new Promise(resolve => {
796 796
             const disconnectListener = (credentials, status) => {
797 797
                 if (status === Strophe.Status.DISCONNECTED) {
798
-                    resolve();
799 798
                     this.eventEmitter.removeListener(XMPPEvents.CONNECTION_STATUS_CHANGED, disconnectListener);
799
+                    resolve();
800 800
                 }
801 801
             };
802 802
 

Loading…
Cancel
Save