The fully qualified url to your Phoenix socket endpoint.
Optional
queryParams: { Optional object of key/value pairs to be appended to the url as query parameters.
Optional
timeoutInMs: numberOptional timeout value in milliseconds, if not provided the default 60 second timeout will be used.
Private
Readonly
HEARTBEAT_Private
Readonly
TIMEOUT_Private
Readonly
TIMEOUT_Private
_connectionPrivate
_nextPrivate
connectionPrivate
heartbeatPrivate
logA callback to be called whenever the WebSocket successfully connects or reconnects.
Private
onA callback to be called whenever the WebSocket is disconnected.
Private
phoenixPrivate
reconnectionPrivate
Optional
socketPrivate
topicsPrivate
wsThe current status of the WebSocket connection.
Protected
nextAn array of all the topics you are currently successfully connected to. Does not include topics that have been disconnected, or that are in the process of connecting.
Private
_connectPrivate
attemptClose the current websocket connection.
Optional
clearTopics: boolean = trueIf true, all topics will be unsubscribed from and removed as part of the disconnection. If false, the topics will remain subscribed to and will automatically be resubscribed to if the socket is reconnected.
Private
disposePrivate
joinPrivate
leaveProtected
onPrivate
onProtected
onProtected
onProtected
onPrivate
schedulePrivate
sendSend a message and optional payload to the given topic.
The topic to send the message to. You must already be subscribed to this topic a topic before you can send a message to it.
The message to send.
Optional
payload: { An optional payload to be sent along with the message.
A promise which will resolve with the reply sent from the server.
Set the log level for this PhoenixWebsocket instance. If you would like nothing to be logged to the browser console, you can set this to PhoenixWebsocketLogLevels.Quiet.
When unchanged, this will log information connection and subscription status to the console by default.
The log level to use.
Subscribe to the passed in topic. This will attempt to subscribe immediately if the websocket connection is already open, otherwise it will try to subscribe once the connection is opened.
Optionally pass in a topicMessageHandler to handle incoming messages for the topic. If this is left undefined, then it is assumed you will only interact with the topic via messages and responses.
If an 'error' status is received from the server in response to the join request, then the promise will be reject with the payload of the error response.
The topic to subscribe to.
Optional
payload: { An optional payload object to be sent along with the join request.
Optional
messageHandlers: { An optional object containing mappings of messages to message handler callbacks, which are called when the given message is received.
Optional
payload: { Optional
messageHandlers: Map<string, TopicMessageHandler>Generated using TypeDoc
Represents a connection instance to a Phoenix Sockets endpoint.