Type Alias: SocketIOServiceEntrypointOptions
SocketIOServiceEntrypointOptions =
object
The options of socketIOServiceEntrypoint.
Properties
event?
optionalevent?:string
The socket.io event carrying the requests: socket.emit('message', {cmd: 'echo', …}, (response) => …).
Default
'message'host?
optionalhost?:string
The host or address of the adapter's own server.
Default
all the interfacesio?
optionalio?:SocketIOServer
An existing socket.io server to serve the requests on, used as is: the adapter neither makes it listen nor closes it, and ignores server, port, host and options.
Default
a socket.io server created by the adapterlistening?
optionallistening?: (io,server) =>void|Promise<void>
Run once the adapter is ready, with the socket.io server and its HTTP server (undefined when io is given without server). A failure fails the entrypoint start.
Parameters
io
SocketIOServer
server
Server | undefined
Returns
void | Promise<void>
middlewares?
optionalmiddlewares?:MiddlewareDefinition[]
The middlewares of this adapter's actions, run after the entrypoint's global middlewares.
name?
optionalname?:string
The adapter name, to tell apart several service adapters of one entrypoint.
namespace?
optionalnamespace?:string
The socket.io namespace receiving the requests.
Default
'/'options?
optionaloptions?:Partial<ServerOptions>
The options of the socket.io server created by the adapter (path, cors, transports…).
port?
optionalport?:number
The port of the adapter's own server (without server and io); 0 picks a random free port. The entrypoint fails to start when the port is in use.
Default
3000server?
optionalserver?:Server| (() =>Server)
An HTTP server to attach the socket.io server to (such as the one of expressHTTPEntrypoint, given to its before hook), or a function returning it when the adapter starts. The adapter then does not listen itself, and when it stops it disconnects the sockets but leaves the HTTP server to its owner.
Default
a server of its own, listening on port