WebSocketClient class

Web socket based client to be used as streaming transport.

Constructors

WebSocketClient({ disconnectionHandler: (message: string) => void, requestHandler: RequestHandler, url: string })

Creates a new instance of the WebSocketClient class.

Methods

connect()

Establish a connection with no custom headers.

disconnect()

Stop this client from listening.

send(StreamingRequest)

Task used to send data over this client connection.

Constructor Details

WebSocketClient({ disconnectionHandler: (message: string) => void, requestHandler: RequestHandler, url: string })

Creates a new instance of the WebSocketClient class.

new WebSocketClient(__namedParameters: { disconnectionHandler: (message: string) => void, requestHandler: RequestHandler, url: string })

Parameters

__namedParameters

{ disconnectionHandler: (message: string) => void, requestHandler: RequestHandler, url: string }

Method Details

connect()

Establish a connection with no custom headers.

function connect(): Promise<void>

Returns

Promise<void>

A promise that will not resolve until the client stops listening for incoming messages.

disconnect()

Stop this client from listening.

function disconnect()

send(StreamingRequest)

Task used to send data over this client connection.

function send(request: StreamingRequest): Promise<IReceiveResponse>

Parameters

request
StreamingRequest

The StreamingRequest instance to send.

Returns

Promise<IReceiveResponse>

A promise that will produce an instance of receive response on completion of the send operation.