WebSocket-based key-value synchronization.
See also:
- ConnectionError
- CredentialsError
- SubscribeError
- EventSubscribeError
- PublishError
- ServerRequestError
- Client
Extends Error
Class representing a connection error
messagestring
Extends Error
Class representing a credentials error
Extends Error
Class representing a subscribe error
Extends Error
Class representing an event subscribe error
Extends Error
Class representing an publishing error
Extends Error
Class representing an error that interupts a pending server request, for example if a connection closes prematurely
Extends EventEmitter
Class representing a Braid Client
Primary data object. Like a native JS Map but with 'set' and 'delete' events.
Set the reconnect handler. The handler determines if the reconnect should continue.
Returns void
Connects to a server.
Returns Promise<void>
Close connection to server.
codenumber? Websocket close reason code to send to the serverreasonstring? Websocket close reason to send to the server
Returns Promise<void>
Send credentials to a server with an open connection.
credentialsObject? Credentials to send
Returns Promise<void>
Subscribe to updates on a key.
keystring Key to request updates on
Returns Promise<void>
Send subscribe request to server
keystring Key to request updates on
Returns Promise<void>
Unsubscribe from updates on a key. If the callback parameter is not provided, all callbacks are unsubscribed.
keystring Key to stop updates on
Returns Promise<void>
Subscribe to a server event
namestring Name of the event to listen forcallbackfunction (): void?
Returns Promise<void>
Send event subscribe request to server
namestring Name of the event to listen for
Returns Promise<void>
Unsubscribe from a server event. If the callback parameter is not provided, all callbacks are unsubscribed.
namestring Name of the event to stop listeningcallbackfunction (any): void?
Returns Promise<void>
Start publishing to a receiver
namestring Name of the receiver to start publishing to
Returns Promise<void>
Publish message to a receiver
namestring Name of the receivermessageany Value to publish, should not contain undefined values
Returns Promise<void>
Send event subscribe request to server
namestring Name of the event to listen for
Returns Promise<void>
Stop publishing to a receiver.
namestring Name of the receiver to stop publishing to
Returns Promise<void>