edgeport - v1.0.6
    Preparing search index...

    Function connect

    • Connects to an XMPP server, authenticates, binds a resource, and returns a live session.

      Dials the core transport (implicit TLS for tls: 'implicit', otherwise plaintext that STARTTLS may upgrade), runs the RFC 6120 handshake, and starts a background pump that routes inbound stanzas. Use await using (or XmppSession.close) to release the connection.

      Parameters

      Returns Promise<XmppSession>

      The live session, bound and ready.

      If the server rejects the credentials.

      If the connection cannot be established.

      If the server speaks the protocol incorrectly.

      If the handshake exceeds the deadline.

      1.0.4

      import { connect } from 'edgeport/xmpp';

      await using xmpp = await connect({
      jid: 'juliet@example.com',
      password: env.XMPP_PW,
      tls: 'starttls'
      });
      await xmpp.setPresence('online');
      await xmpp.send({ to: 'romeo@example.com', body: 'wherefore art thou' });
      for await (const msg of xmpp.messages()) console.log(msg.from, msg.body);