Server class Null safety

The core of the package. This creates the websocket server that listens for incoming commands and passes them off to associated handlers, either internal or external.

The address is the address to listen on and defaults to InternetAddress.anyIPv4.

This requires an authenticator to perform the authentication for the clients.

The optional authorizer allows for authorizing commands against clients. If not set, the default authorizer allows all commands from all clients.

Custom servers needing specialized commands can pass in command handlers via the handlers attribute.

The optional onDone callback allows custom servers the ability to be notified when a socket is closed.

Finally the port parameter provides the application with the ability to specify the port to listen on.


Server({InternetAddress? address, required Authenticator authenticator, Authorizer? authorizer, Map<String, CustomServerCommandHandler>? handlers, dynamic onDone(WebSocket? socket)?, int? port = 5333})


address InternetAddress
hashCode int
The hash code for this object.
read-only, inherited
port int?
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


listen() Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.