edgeport - v1.0.3
    Preparing search index...

    Type Alias WsMessage

    WsMessage:
        | { data: string; type: "text"; json<T = unknown>(): T }
        | { data: Uint8Array; type: "binary" }

    A single inbound WebSocket message.

    Text frames arrive as { type: 'text' } with a string payload; binary frames arrive as { type: 'binary' } with a Uint8Array payload. Branch on type before reading data.

    Type Declaration

    • { data: string; type: "text"; json<T = unknown>(): T }
      • data: string
      • type: "text"
      • json: function
        • Parses the text payload as JSON.

          Type Parameters

          • T = unknown

            The expected shape of the decoded value.

          Returns T

          The parsed value.

          If the text is not valid JSON.

          1.0.2

    • { data: Uint8Array; type: "binary" }

    1.0.0