Interface: Server<E>
server.Server
Type parameters
Name | Type |
---|---|
E | undefined |
Methods
opened
▸ opened(socket
, ctxExtra
): (code?
: number
, reason?
: string
) => Promise
<void
>
New socket has been established. The lib will validate the protocol and use the socket accordingly. Returned promise will resolve after the socket closes.
The second argument will be passed in the extra
field
of the Context
. You may pass the initial request or the
original WebSocket, if you need it down the road.
Returns a function that should be called when the same socket
has been closed, for whatever reason. The close code and reason
must be passed for reporting to the onDisconnect
callback. Returned
promise will resolve once the internal cleanup is complete.
Parameters
Name | Type |
---|---|
socket | WebSocket |
ctxExtra | E |
Returns
fn
▸ (code?
, reason?
): Promise
<void
>
Parameters
Name | Type |
---|---|
code? | number |
reason? | string |
Returns
Promise
<void
>