Readonly [initProtected Optional _localProtected Optional _localProtected _remoteProtected _remoteProtected caDERsProtected certDERsProtected closeOptional errorCode: numberOptional reason: stringReadonly closedPConnection closed promise. This can resolve or reject.
Protected codeConverts code to reason.
Used during WebSocketStream creation.
Protected configReadonly connectionThis is the source connection ID.
Protected errorThis stores the last dispatched error.
If no error has occurred, it will be null.
Protected Optional keepReadonly keepPromise that resolves once the keepAliveResponsibility has been established. This is true if we are responsible for sending pings, and false when the peer is responsible.
Protected Optional keepProtected loggerProtected pingsProtected pongsProtected reasonConverts reason to code.
Used during WebSocketStream creation.
Protected rejectOptional reason: anyProtected remoteProtected resolveProtected resolveProtected resolveProtected secureSecure connection establishment.
This can resolve or reject.
Will resolve after connection has established and peer certs have been validated.
Rejections cascade down to secureEstablishedP and closedP.
Protected secureProtected sendThis should never reject.
Protected socketProtected streamClient initiated bidirectional stream starts at 0. Increment by 4 to get the next ID.
Protected streamStream ID increment lock.
Protected streamServer initiated bidirectional stream starts at 1. Increment by 4 to get the next ID.
Readonly typeThis determines when it is a client or server connection.
Whether the underlying WebSocket has been closed.
Gets an array of CA certificates in DER format starting on the leaf.
This will be empty if:
WebSocketServer with an injected https.Server orWebSocketClient running in a browserGets an array of local certificates in DER format starting on the leaf.
This will be empty if:
WebSocketServer with an injected https.Server orWebSocketClient running in a browserProtected handleProtected handleProtected handleProtected handleProtected handleProtected handleProtected handleProtected handleProtected handleProtected handleProtected handleGets the connection metadata.
Some certs may be unavailable with certain injected config options or on certain platforms, please @see:
Creates a new bidirectional WebSocketStream.
Private sendProtected setProtected startStops WebSocketConnection
Optional errorThe error code to send to the peer on closing
Optional force?: booleanWhen force is false, the returned promise will wait for all streams to close naturally before resolving.
Optional reason?: stringProtected stopProtected stopGenerated using TypeDoc
Think of this as equivalent to
net.Socket. This is one-to-one with the ws.WebSocket. Errors here are emitted to the connection only. Not to the server.Events:
Note that on TLS verification failure, EventWebSocketConnectionError is emitted with the following
event.detail:event.detailwill be an instance of ErrorWebSocketConnectionLocalTLS.event.detailwill be an instance of ErrorWebSocketConnectionPeer with an error code of AbnormalClosure.The reason for this is that when the peer fails to verify us, Node only tells us that the TCP socket has been reset, but not why.