RpcConnectionHost class final
The per-connection half of a server: the endpoint for each connection, its release when the connection ends, the connection cap, and drain-then-close.
The server keeps what is its own: accepting, the handshake, and how a refused connection is told.
Constructors
- RpcConnectionHost({required RpcServerMode mode, int? maxConnections, LogScope? logger, LogController? logController, bool compressionEnabled = false})
-
maxConnectionscaps the connections admit lets in, or null for no cap.logControllerandcompressionEnabledare handed to every endpoint.
Properties
- compressionEnabled → bool
-
Whether each endpoint compresses its responses (and, in peer mode, its
requests). See RpcResponderEndpoint.compressionEnabled.
final
-
endpoints
→ List<
RpcResponderEndpoint> -
Every live endpoint, peer-mode ones included. What
IRpcServer.endpointsreturns.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- length → int
-
Live connections.
no setter
- maxConnections → int?
-
The cap on concurrent connections, or null.
final
- mode → RpcServerMode
-
What each connection gets.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
admit(
{int pending = 0}) → bool -
Whether one more connection fits under the cap, counting
pendingconnections the server holds that have no endpoint yet (a handshake in progress). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
release(
RpcEndpointBase endpoint) → void -
Drops
endpointand closes it, which is what disposes its contracts, then runs itsonRelease. Idempotent. -
serve(
IRpcTransport transport, {required Future< void> done, String? debugLabel, void onRelease()?}) → RpcResponderEndpoint -
Builds and starts the endpoint for
transport, released whendonecompletes, with a value or an error. -
stop(
{Duration? drainTimeout}) → Future< void> - Closes every endpoint, optionally letting in-flight calls finish first.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited