Interface WebSocketMessage

interface WebSocketMessage {
    content: Uint8Array;
    direction: "sent" | "received";
    eventTimestamp: number;
    isBinary: boolean;
    streamId: string;
    tags: string[];
    timingEvents: TimingEvents;
}

Properties

content: Uint8Array

The contents of the message as a raw buffer. This is already decompressed, if the WebSocket uses compression.

direction: "sent" | "received"

Whether the message was sent by Mockttp, or received from a Mockttp client.

eventTimestamp: number

A high-precision floating-point monotonically increasing timestamp. Comparable and precise, but not related to specific current time.

To link this to the current time, compare it to timingEvents.startTime.

isBinary: boolean

Whether this is a string message or a raw binary data message.

streamId: string

The id of this websocket stream. This will match the id of the request, the initial connection response, and any other WebSocket events for the same connection stream.

tags: string[]
timingEvents: TimingEvents