Owns the ws server for one Node HTTP adapter and performs the handshake.
Split out of the adapter so the adapter keeps its single responsibility
(mapping HTTP) and so the handshake's branches are measurable in isolation.
The ws server is created on the first accepted upgrade — a plain HTTP
application therefore never loads the optional dependency at all.
NodeUpgradeCoordinator(module?: WsModuleLike)
Creates the coordinator.
Parameters
optional
module: WsModuleLike
An injected ws module; omit to load it lazily
readonly
hasServer: boolean
Whether a ws server has been created yet.
close(): void
Shuts down the ws server, when one was ever created.
handshake(incoming: NodeIncomingMessage,socket: unknown,head: unknown,sink: WebSocketEventSink,protocol?: string): Promise<void>
Completes the RFC 6455 handshake over an already-accepted TCP connection and binds the resulting socket to the decision's sink.