Преглед изворни кода

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 година
родитељ
комит
cf2914ddfc
2 измењених фајлова са 4 додато и 1 уклоњено
  1. 3
    0
      modules/xmpp/XmppConnection.js
  2. 1
    1
      modules/xmpp/xmpp.js

+ 3
- 0
modules/xmpp/XmppConnection.js Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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…
Откажи
Сачувај