IoWebSocketHost<S extends ClientSession> mixin

Gives a SessionHostServer a dart:io HttpServer of its own.

The host below it works on any transport; a host embedded in another HTTP server does not mix this in and stays free of dart:io.

Superclass constraints
Mixin applications

Properties

compressor → Compressor
Compressor handed to every session this host creates.
finalinherited
debugLabel → String
Name of the concrete host, used in diagnostics.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
host → String
The server host; '' while the server is not running.
no setter
isRunning → bool
Whether this host accepts sessions and does its background work.
no setterinherited
maxBufferSize → int?
Maximum outbound buffer size per client session (bytes).
finalinherited
messageCodec → MessageCodec<Message>?
Message codec handed to every session this host creates.
finalinherited
ownsTransport → bool
Whether this host owns the transport it serves on.
no setteroverride
plugins → List<ServerSyncPlugin>
The server plugins
finalinherited
port → int
The server port; 0 while the server is not running.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
serverEvents → Stream<ServerEvent>
Server events stream
no setterinherited
serverFactory → Future<HttpServer> Function()
Creates the HttpServer this host serves on.
no setter
serverTransformer → WebSocketServerTransformer
Upgrades an HttpRequest to a WebSocket.
no setter
sessions → Map<String, S>
Active sessions, by id.
no setterinherited
startedMessage → String
Message of the ServerEventType.started event.
no setterinherited
state → SessionHostState
Where this host is in its lifecycle.
no setterinherited
stoppedMessage → String
Message of the ServerEventType.stopped event.
no setterinherited

Methods

acceptConnection(TransportConnection connection, {String? sessionId}) → S?
Register connection as a new session and return it.
inherited
addServerEvent(ServerEvent event) → void
Emit a ServerEvent on serverEvents.
inherited
broadcastMessage(Message message, {List<String>? excludeClientIds}) → Future<void>
Broadcast a message to all subscribed clients
inherited
closeAllSessions() → Future<void>
Gracefully close every session.
inherited
createSession({required String id, required TransportConnection connection}) → S
Create the session for a newly accepted connection.
inherited
dispose() → Future<void>
Dispose the server
inherited
handleSessionClosed(String sessionId) → void
Drop a session whose event stream ended.
inherited
handleSessionError(String sessionId, dynamic error) → void
Report an error on a session's event stream.
inherited
handleSessionEvent(SessionEvent event) → FutureOr<void>
Handle a SessionEvent from one of this host's sessions.
inherited
handleSessionEventDisconnected(SessionEventGeneric event) → void
Report a disconnect and drop the session.
inherited
handleSessionEventError(SessionEventGeneric event) → void
Report a session-level error.
inherited
handleSessionEventPingReceived(SessionEventGeneric event) → FutureOr<void>
Report a ping from a client.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDispose() → Future<void>
Release what this host holds beyond its sessions and plugins.
inherited
onRunning() → void
Runs each time this host becomes isRunning: on start, or on the first acceptConnection of a host that does not own its transport.
inherited
onStart() → Future<void>
Bring up the transport this host owns. Only called when ownsTransport.
override
onStarted() → Future<void>
Start serving requests. Only called when ownsTransport.
override
onStop() → Future<void>
Tear down the transport this host owns. Only called when ownsTransport.
override
sendMessageToClient(String clientId, Message message) → Future<void>
Send a message to a specific client
inherited
sessionById(String id) → S?
The session with id, if this host still holds it.
inherited
start() → Future<bool>
Start the server
inherited
startFailureMessage(Object error) → String
Message of the ServerEventType.error event reported when start fails.
inherited
stop() → Future<void>
Stop the server
inherited
toString() → String
A string representation of this object.
inherited

Operators

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