edgeport - v1.0.3
    Preparing search index...

    Interface StompSession

    A live STOMP session over a single socket.

    Obtain one from connect. A background pump reads the socket and routes frames, so sending, subscribing, and receiving can all be in flight at once. It is an AsyncDisposable, so await using closes it cleanly (sending DISCONNECT with a receipt first).

    1.0.0

    interface StompSession {
        "[asyncDispose]"(): PromiseLike<void>;
        begin(): Promise<StompTransaction>;
        close(): Promise<void>;
        send(
            destination: string,
            body: string | Uint8Array<ArrayBufferLike>,
            opts?: { contentType?: string; headers?: Record<string, string> },
        ): Promise<void>;
        sendJson(
            destination: string,
            value: unknown,
            opts?: { headers?: Record<string, string> },
        ): Promise<void>;
        subscribe(
            destination: string,
            opts?: {
                ack?: "auto" | "client" | "client-individual";
                headers?: Record<string, string>;
            },
        ): StompSubscription;
        unsubscribe(id: string): Promise<void>;
    }

    Hierarchy

    • AsyncDisposable
      • StompSession
    Index
    • Returns PromiseLike<void>

    • Sends DISCONNECT with a receipt, waits for it, and closes the socket.

      Returns Promise<void>

      Resolves once the socket is closed.

    • Sends a message to a destination.

      Parameters

      • destination: string

        The destination to send to (e.g. /queue/a).

      • body: string | Uint8Array<ArrayBufferLike>

        The payload; strings are UTF-8 encoded.

      • Optionalopts: { contentType?: string; headers?: Record<string, string> }

        Optional extra headers and a content-type.

      Returns Promise<void>

      Resolves once the SEND frame is written.

      If the session is closed.

    • Sends a value as a JSON message to a destination.

      Serializes value with JSON.stringify, sends it via send with a content-type: application/json header (overriding any contentType in opts).

      Parameters

      • destination: string

        The destination to send to (e.g. /queue/a).

      • value: unknown

        The value to serialize and send.

      • Optionalopts: { headers?: Record<string, string> }

        Optional extra headers (a contentType here is ignored in favour of JSON).

      Returns Promise<void>

      Resolves once the SEND frame is written.

      If the session is closed.

      1.0.2

    • Subscribes to a destination.

      Parameters

      • destination: string

        The destination to subscribe to.

      • Optionalopts: {
            ack?: "auto" | "client" | "client-individual";
            headers?: Record<string, string>;
        }

        Optional ack mode (defaults to 'auto') and extra headers.

      Returns StompSubscription

      A subscription whose async iterator yields matching messages.

      If the session is closed.

    • Unsubscribes by subscription id.

      Parameters

      • id: string

        The subscription id to cancel.

      Returns Promise<void>

      Resolves once the UNSUBSCRIBE is written.