edgeport - v1.0.3
    Preparing search index...

    Function connect

    • Connects to a STOMP broker, performs the handshake, and returns a live session.

      Dials the core transport (implicit TLS when tls: 'implicit', otherwise plaintext optionally upgraded via starttls), sends CONNECT with accept-version, host, heart-beat, and any login/passcode, and waits for CONNECTED. An ERROR frame during connect surfaces as AuthError when it looks auth-related, otherwise ProtocolError. A background pump then routes messages and receipts.

      Parameters

      Returns Promise<StompSession>

      The live session.

      If the broker rejects the credentials.

      If the connection cannot be established.

      If the broker speaks the protocol incorrectly.

      If the handshake exceeds the deadline.

      1.0.0

      import { connect } from 'edgeport/stomp';

      await using stomp = await connect({
      hostname: 'broker.example.com',
      login: 'user',
      passcode: 'secret'
      });
      await stomp.send('/queue/jobs', 'hello');
      await using sub = stomp.subscribe('/queue/jobs');
      for await (const msg of sub) {
      console.log(new TextDecoder().decode(msg.body));
      break;
      }