Properties
Optional backlog
backlog: undefined | number
Optional clientTracking
clientTracking: undefined | false | true
Optional handleProtocols
handleProtocols: any
Optional handshake
handshake
: undefined | ((token
: Id, ws
: ClientSocket) => Promise<boolean> | boolean)
Optional host
host: undefined | string
Optional maxPayload
maxPayload: undefined | number
Optional noServer
noServer: undefined | false | true
Optional path
path: undefined | string
Optional perMessageDeflate
Optional port
port: undefined | number
Optional prepareContext
prepare
Context: undefined | ((ctx: RPCContext) => any)
Optional server
server: Server | Server
An asynchronous function which handles every new connection. It accepts two arguments, token and ws. Function must return
true
value if we want to establish the connection. And the connection will be dropped otherwise.Unique token of the client
A websocket instance of the connection
handshake: async (token) => { console.log('trying to connect', token); if (await theUserExistsInTheDatabase(token)) { return true; } else { return false } }