Implement the WebSocket W3C browser API for testing.

Hierarchy

  • MockWebSocket

Constructors

Properties

_queuedResponses: Map<number, Response>
lastRequest: null | Request
readyState: number
requests: Request[]
responses: any
url: string

Methods

  • Parameters

    • requestId: number

    Returns void

  • Parameters

    • reason: string
    • code: number = 1000
    • wasClean: boolean = true

    Returns void

  • Parameters

    • msg: string

    Returns void

  • Parameters

    • _params: {
          code: number;
          reason: string;
          wasClean: boolean;
      }
      • code: number
      • reason: string
      • wasClean: boolean

    Returns void

  • Parameters

    • _params: {
          data: string;
      }
      • data: string

    Returns void

  • Returns void

  • Returns void

  • Queue up a number of response values for upcoming requests.

    Parameters

    • responses: Map<number, Response>

      The response values as a map where the Id is the request-id and the value is the response value. The response value does not need to include the request-id key.

    Returns void

  • Reply to requests from the WebSocket.

    Parameters

    • resp: Response

      The response for the request in a JSON.stringify-able format.

    Returns void

  • Parameters

    • msg: string

    Returns void

Generated using TypeDoc