Create a WebSocketReliable object, and open it if an url is passed in argument
Optionalurl: string | URLURL of the WebSocket endpoint or null to start the connection later
Optionalprotocols: string | string[]binaryType, fix binary type to arrayBuffer
The number of bytes of data that were queued during calls to send() but not yet transmitted to the network
True when connection is closed, in other words when onClose event is fired or when WebSocketReliable is build without url (disconnected creation)
extensions negociated by the server
opened equals true when connection is etablished, in other word when onOpen event is fired
protocol negociated by the server
Queued messages from a call to send() waiting to be transmit one time websocket connection opened (or with an explicit call to flush() method)
url of connection
Close websocket
Optionalerror: WebSocketReliableErrorthe error reason if is not a proper close
Send queueing messages
Event subscription
Name of event without the on prefix (ex: log to onLog event declared)
Subscriber Function
Optionaloptions: { signal?: AbortSignal }Optionalsignal?: AbortSignalOptional AbortSignal to stop this or multiple subscriptions in same time
Event subscription only one time, once time fired it's automatically unsubscribe
Name of event without the on prefix (ex: log to onLog event declared)
Subscriber Function
Optionaloptions: { signal?: AbortSignal }Optionalsignal?: AbortSignalOptional AbortSignal to stop this or multiple subscriptions in same time
Open a WebSocket connection
url of the websocket endpoint
Optionalprotocols: string | string[]this
Send a message
When set it reports the sending to a more later call to flush
this
Fired on websocket close
Optionalerror: WebSocketReliableErrorerror description on an improper closure
Fired on message reception
can be binary or string. If you subscribe to the event with message as string type (and not union), it means that you know that all your messages are distributed in a string format
Fired when socket is connected
The WebSocketReliable class extends WebSocket to bring up the following improvements:
Example