Skip to content

Class: ReconnectingConnection

A WebSocket that transparently reconnects and buffers sends while offline.

Constructors

Constructor

new ReconnectingConnection(url, options?): ReconnectingConnection

Parameters

url

string

options?

ConnectionOptions

Returns

ReconnectingConnection

Accessors

connected

Get Signature

get connected(): boolean

Whether the socket is currently open.

Returns

boolean

Methods

close()

close(): void

Close the connection and stop reconnecting.

Returns

void


send()

send(data): void

Send a text frame, buffering it if the socket is not open yet.

Parameters

data

string

Returns

void


start()

start(): void

Open the connection (idempotent while already connecting/connected).

Returns

void