Optional
acceptWhether the server should accept new users. If set to false, only users joined via server.join(
When not provided, the server will accept new users.
Optional
authThe timeout in milliseconds that the server should wait for the authentication process to complete. If the authentication process does not complete within this time, the connection will be rejected. If a value smaller than 1 is provided, 1 will be used.
When not provided, the server will wait a maximum of 10_000 milliseconds (10 seconds) for the authentication process to complete.
Optional
httpThe http configuration that the Server should use.
Optional
path?: stringThe http path the Server should use for the websocket server.
When not provided, the websocket server will use the root path.
Optional
queryQuery string parameters that all connections must provide in their connection url.
For example: when it is set to { krmx: 'my-server-1-0-2' } a client should connect with 'ws:127.0.0.1:80/example?krmx=my-server-1-0-2'
Optional
server?: Server<typeof IncomingMessage, typeof ServerResponse>The http server that the Server should use.
When not provided, a new http server will be created.
When not provided, a new http server will be created and the WebSocket server will be on the root path.
Optional
isA predicate that determines what the server should consider to be a valid username.
A predicate that determines what the server should consider to be a valid username.
When not provided, the server will validate usernames using the username regex (exported by Krmx as usernameRegex).
When not provided, the server will validate usernames using the username regex (exported by Krmx as usernameRegex).
Optional
loggerThe logger that the Server should use.
When not provided, it will log (non debug) to the standard console.
Optional
pingThe interval in milliseconds at which the server should ping all connections to check if they are still alive. If the number is set to a value 0 or less, the server will not ping connections. If the value is set to a value between 1 and 100, the server will ping connections every 100 milliseconds instead.
If when a connection has not responded to a ping before the server sends out the next ping, the connection will be terminated.
When not provided, the server will ping connections every 15_000 milliseconds (15 seconds).
The properties with which to create the Server.