edgeport - v1.0.3
    Preparing search index...

    Function encodeFrame

    • Encodes a STOMP frame into its on-the-wire bytes.

      Emits the command line, escaped header lines, a blank line, the body, and the terminating NUL. When a body is present and no content-length header was supplied, one is added so binary bodies with embedded NULs round-trip; pass an empty body to omit it entirely.

      Parameters

      • command: string

        The frame command.

      • headers: Record<string, string>

        The (unescaped) headers to send.

      • body: Uint8Array = ...

        The raw body bytes; defaults to empty.

      Returns Uint8Array

      The full frame as bytes, ready to write.

      1.0.0

      import { encodeFrame } from 'edgeport/stomp';

      const bytes = encodeFrame('SEND', { destination: '/queue/a' }, new TextEncoder().encode('hi'));