WebSocket-based key-value synchronization.
See also:
- ConnectionError
- CredentialsError
- SubscribeError
- EventSubscribeError
- PublishError
- ServerRequestError
- Client
Extends Error
Class representing a connection error
message
string
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.
code
number? Websocket close reason code to send to the serverreason
string? Websocket close reason to send to the server
Returns Promise<void>
Send credentials to a server with an open connection.
credentials
Object? Credentials to send
Returns Promise<void>
Subscribe to updates on a key.
key
string Key to request updates on
Returns Promise<void>
Send subscribe request to server
key
string 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.
key
string Key to stop updates on
Returns Promise<void>
Subscribe to a server event
name
string Name of the event to listen forcallback
function (): void?
Returns Promise<void>
Send event subscribe request to server
name
string 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.
name
string Name of the event to stop listeningcallback
function (any): void?
Returns Promise<void>
Start publishing to a receiver
name
string Name of the receiver to start publishing to
Returns Promise<void>
Publish message to a receiver
name
string Name of the receivermessage
any Value to publish, should not contain undefined values
Returns Promise<void>
Send event subscribe request to server
name
string Name of the event to listen for
Returns Promise<void>
Stop publishing to a receiver.
name
string Name of the receiver to stop publishing to
Returns Promise<void>