WebSocketServer.constructor
opts.server is not provided, .start will create a new https server.opts.server is provided and not already listening, .start make the server start listening and use the provided server.opts.server is provided and already listening, .start use the provided server.opts.server is provided, verifyCallback and verifyPeer must be undefined, and the TLS verification policy will follow that of the underlying server.Readonly [initProtected _closedProtected _closedPResolved when the underlying server is closed.
Protected _hostProtected _portOptional codeCustom code to reason converted for new connections.
Protected configConfiguration for new connections.
Optional connectConnection timeout for new connections.
Readonly connectionMap of connections with connectionId keys that correspond to WebSocketConnection values.
Readonly isDetermines whether the socket is injected or not
Protected loggerOptional reasonCustom reason to code converter for new connections.
Protected resolveProtected resolveProtected serverProtected webProtected webBoolean that indicates whether the internal server is closed or not.
This will be initially be false when WebSocketServer is constructed.
Protected handleProtected handleThis must be attached once.
Protected handleProtected handleThis must be attached once.
Protected handleProtected handleProtected handleProtected handleProtected handleStarts the WebSocketServer.
If the server is shared and it is not listening, it will be started. If the server is not shared, a server will be created and started.
Optional host?: stringhost to listen on, defaults to '::'
Optional ipv6ipv6 only, defaults to false
Optional path?: stringthe path the WebSocketServer should respond to upgrade requests on
Optional port?: numberport to listen on, defaults to 0
Stops WebSocketServer
Optional errorThe error code to send to connections on closing
Optional errorThe error message to send to connections on closing
Optional force?: booleanWhen force is false, the returned promise will wait for all streams and connections to close naturally before resolving.
Updates the server config. Existing connections will not be affected.
Generated using TypeDoc
You must provide an error handler
addEventListener('error'). Otherwise, errors will just be ignored.Events: