xmppjs / xmpp.js

XMPP for JavaScript
ISC License
2.18k stars 371 forks source link

Stuck on open stage does not goes to "online" state #1001

Closed z9fr closed 8 months ago

z9fr commented 8 months ago

⚠ If you need help with XMPP itself, please visit https://xmpp.org/community/ instead.

Describe the bug

so basically when i try to open the xmpp connection its always stuck on the "OPEN" stage and never goes to the "ONLINE" stage

 LOG  wss://chat.prosody.z9fr.xyz:5281/xmpp-websocket
 DEBUG  status connecting wss://chat.prosody.z9fr.xyz:5281/xmpp-websocket
 LOG  wss://chat.prosody.z9fr.xyz:5281/xmpp-websocket
 DEBUG  status connecting wss://chat.prosody.z9fr.xyz:5281/xmpp-websocket
 LOG  undefined
 DEBUG  status connect
 LOG  undefined
 DEBUG  status opening
 LOG  {"attrs": {"from": "chat.prosody.z9fr.xyz", "id": "b0984ce4-149c-4a9d-86ee-289af90d5342", "version": "1.0", "xml:lang": "en", "xmlns": "urn:ietf:params:xml:ns:xmpp-framing"}, "children": [], "name": "open", "parent": null}
 DEBUG  status open <open version="1.0" id="b0984ce4-149c-4a9d-86ee-289af90d5342" xml:lang="en" from="chat.prosody.z9fr.xyz" xmlns="urn:ietf:params:xml:ns:xmpp-framing"/>
 DEBUG  IN
<stream:features xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams"><auth xmlns="http://jabber.org/features/iq-auth"/><register xmlns="http://jabber.org/features/iq-register"/></stream:features>
 LOG  undefined
 DEBUG  status connect
 LOG  undefined
 DEBUG  status opening
 LOG  {"attrs": {"from": "chat.prosody.z9fr.xyz", "id": "abf48544-363c-4125-a1ab-4c7477ed894f", "version": "1.0", "xml:lang": "en", "xmlns": "urn:ietf:params:xml:ns:xmpp-framing"}, "children": [], "name": "open", "parent": null}
 DEBUG  status open <open version="1.0" id="abf48544-363c-4125-a1ab-4c7477ed894f" xml:lang="en" from="chat.prosody.z9fr.xyz" xmlns="urn:ietf:params:xml:ns:xmpp-framing"/>
 DEBUG  IN
<stream:features xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams"><auth xmlns="http://jabber.org/features/iq-auth"/><register xmlns="http://jabber.org/features/iq-register"/></stream:features>

below is the code that im trying to execute

import {client, xml} from '@xmpp/client';
import debug from '@xmpp/debug';

(async () => {
  try {
    const xmpp = client({
      service: '<host>',
      domain: '<domain>',
      resource: 'example',
      username: 'username',
      password: 'password',
    });

    debug(xmpp, true);
    xmpp.on('status', status => console.log(status));

    xmpp.on('error', err => {
      console.error(err);
    });

    xmpp.on('online', async address => {
      console.log('=== online success ===');
      console.log('online as', address.toString());
    });

    await xmpp.start();
  } catch (e) {
    console.log(e);
  }
})();

Environment

"@xmpp/client": "^0.13.1", "@xmpp/debug": "^0.13.0",