NodeWebSocketFactory class

Represents a NodeWebSocketFactory to create a WebSocket server.

Extends

Constructors

NodeWebSocketFactory()

Initializes a new instance of the NodeWebSocketFactory class.

Methods

createWebSocket(INodeIncomingMessage, INodeSocket, INodeBuffer)

Creates a NodeWebSocket instance.

Constructor Details

NodeWebSocketFactory()

Initializes a new instance of the NodeWebSocketFactory class.

new NodeWebSocketFactory()

Method Details

createWebSocket(INodeIncomingMessage, INodeSocket, INodeBuffer)

Creates a NodeWebSocket instance.

function createWebSocket(req: INodeIncomingMessage, socket: INodeSocket, head: INodeBuffer): Promise<NodeWebSocket>

Parameters

req
INodeIncomingMessage

An IncomingMessage from the 'http' module in Node.js.

socket
INodeSocket

The Socket connecting the bot and the server, from the 'net' module in Node.js.

head
INodeBuffer

The first packet of the upgraded stream which may be empty per https://nodejs.org/api/http.html#http_event_upgrade_1.

Returns

Promise<NodeWebSocket>

A NodeWebSocket instance ready for streaming.

Remarks

The parameters for this method should be associated with an 'upgrade' event off of a Node.js HTTP Server.