The subprotocol that was chosen to be spoken on this connection. This field
will have been converted to lower case.
public remoteAddress:string
The IP address of the remote peer as a string. In the case of a server,
the X-Forwarded-For header will be respected and preferred for the purposes
of populating this field. If you need to get to the actual remote IP address,
socket.remoteAddress will provide it.
Close the connection. A close frame will be sent to the remote peer indicating
that we wish to close the connection, and we will then wait for up to
config.closeTimeout milliseconds for an acknowledgment from the remote peer
before terminating the underlying socket connection.
public drop(reasonCode?: number, description?: string)
Send a close frame to the remote peer and immediately close the socket without
waiting for a response. This should generally be used only in error conditions.
Parameters
reasonCode?: numberoptional
description?: stringoptional
public emit(event: string, args?: Array<any>): boolean
Parameters
event: string
args?: Array<any>optional
Returns
boolean
public fragmentAndSend(frame: frame, cb?: (err: Error) => void)
Sends a pong frame. Pong frames may be sent unsolicited and such pong frames will
trigger no action on the receiving peer. Pong frames sent in response to a ping
frame must mirror the payload data of the ping frame exactly.
The connection object handles this internally for you, so there should
be no need to use this method to respond to pings.
Pong frames must not exceed 125 bytes in length.
Immediately sends the specified Node Buffer object as a Binary WebSocket message
to the remote peer. If config.fragmentOutgoingMessages is true the message may be
sent as multiple fragments if it exceeds config.fragmentationThreshold bytes.
Serializes a frame object into binary data and immediately sends it to
the remote peer. This is an advanced function, requiring you to manually compose
your own frame. You should probably use sendUTF or sendBytes instead.
Immediately sends the specified string as a UTF-8 WebSocket message to the remote
peer. If config.fragmentOutgoingMessages is true the message may be sent as
multiple fragments if it exceeds config.fragmentationThreshold bytes.