An id to assign to this socket instance. This is used through the debug
package to display a different debug
tag when provided (i.e. dfuse:socket:<id>
).
Whether ping
messages should be send automatically at regular interval
by the Socket instance. The actual interval used can be defined by
providing the SocketOptions.keepAliveIntervalInMs option.
The interval of time at which ping
messages are automatically sent to
the remote endpoint. This is time that elapsed between two consecutives
ping
messages.
As no effect if SocketOptions.keepAlive is sets to false
.
A callback that can be provided to be notified when the Socket receives a close event. The close event is always emitted even when an error has occurred, it will however always come after the error event.
The callback will be invoked with the actual event as defined by the WebSocket
instance used.
Important Note
The actual event
object you will receive is different wheter you use
the Browser WebSocket
instance (CloseEvent)
or depending on the Node.js library you use (If you use ws package, then it's
CloseEvent)
A callback that can be provided to be notified when the Socket receives an error event. The error event is always emitted only where an error occurred with the connection. It is not emitted on a normal and expected disconnection with the server (when closing the underlying socket for example).
The callback will be invoked with the actual event as defined by the WebSocket
instance used.
Important Note
The actual event
object you will receive is different wheter you use
the Browser WebSocket
instance (ErrorEvent)
or depending on the Node.js library you use (If you use ws package, then it's
ErrorEvent)
A callback that can be provided to be notified when the Socket just performed a re-connection. This will be called after a successful re-connection. When the callback is invoked, the connection with the server has actually resumed and stream can be restarted or other actions can be taken.
This is a post re-connection callback.
The delay after the abnormal closure of the connection before trying a
re-connection. As no effect if SocketOptions.autoReconnect is sets
to false
.
A factory method used to create the WebSocket
instance that should be
used by the Socket instance.
Inferrence
When not provided (default), the factory to use is actually inferred
based on the runtime environment.
If a window.WebSocket
variable exists, which should be the case on a Browser
environment, the factory used will call new window.WebSocket(...)
to instantiate
the WebSocket
instance.
If a global.WebSocket
variable exists, which can be the case upon a
global.WebSocket = ...
call at the bootstrap phase in a Node.js environment,
the factory used will call new global.WebSocket(...)
to instantiate
the WebSocket
instance.
Finally, if no WebSocket
instance could be determined, a DfuseError is
thrown with a message explaining the situtation and a link to the documentation
on how to solve the problem.
The set of webSocket protocols we want to send when performing the
connection handshake. For example, GraphQL subscription over WebSocket
uses "graphql-ws" protocol while standard WebSocket connection can
pass undefined
as the value.
Generated using TypeDoc
Determines if the socket should automatically re-connect with the upstream service upon an abnormal disconnection.
The re-connection happens after the given SocketOptions.reconnectDelayInMs has elapsed.
true