Class: SocketIOWebSocketConnection
Represents a WebSocket connection, including the connection details and methods to interact with it.
Implements
Constructors
Constructor
new SocketIOWebSocketConnection(
socket):SocketIOWebSocketConnection
Parameters
socket
Socket
Returns
SocketIOWebSocketConnection
Accessors
connected
Get Signature
get connected():
boolean
Whether the underlying transport connection is still open.
Returns
boolean
Whether the underlying transport connection is still open.
Implementation of
id
Get Signature
get id():
string
Unique identifier for this connection.
Returns
string
Unique identifier for this connection.
Implementation of
namespace
Get Signature
get namespace():
string|undefined
Namespace this connection belongs to, if the adapter supports namespaces.
Returns
string | undefined
Namespace this connection belongs to, if the adapter supports namespaces.
Implementation of
rooms
Get Signature
get rooms(): readonly
string[]
Rooms/channels this connection currently belongs to, if the adapter supports them.
Returns
readonly string[]
Rooms/channels this connection currently belongs to, if the adapter supports them.
Implementation of
Methods
broadcast()
broadcast<
TData>(room,event,data?):void
Broadcasts an event to a room (excluding or including self, per adapter convention).
Type Parameters
TData
TData = unknown
Parameters
room
string
event
string
data?
TData
Returns
void
Implementation of
close()
close(
_code?,_reason?):void
Closes the connection, optionally with a reason code/message.
Parameters
_code?
number
_reason?
string
Returns
void
Implementation of
emit()
emit<
TData>(event,data?):void
Sends an event with a payload to this connection only.
Type Parameters
TData
TData = unknown
Parameters
event
string
data?
TData
Returns
void
Implementation of
join()
join(
room):void
Joins a room/channel, if supported by the underlying adapter.
Parameters
room
string
Returns
void
Implementation of
leave()
leave(
room):void
Leaves a room/channel, if supported by the underlying adapter.
Parameters
room
string
Returns
void