RpcChannelTransport class

Full IRpcTransport built from an IRpcMultiplexedChannel.

Adds stream-ID management, policy enforcement, flow control and health checks on top of any multiplexed channel.

// from a raw byte channel (WebSocket, TCP, ...)
RpcChannelTransport.fromChannel(channel: myByteChannel, isClient: true);
// from a multiplexed one
RpcChannelTransport(channel: myMuxChannel, isClient: true);
Inheritance

Constructors

RpcChannelTransport({required IRpcMultiplexedChannel channel, required bool isClient, RpcSecurityPolicy policy = const RpcSecurityPolicy(), Future<void>? ready, LogScope? logger})
Creates a transport that wraps a IRpcMultiplexedChannel.
RpcChannelTransport.fromChannel({required IRpcChannel channel, required bool isClient, RpcSecurityPolicy policy = const RpcSecurityPolicy(), Future<void>? ready, Duration? prefaceTimeout, LogScope? logger})
Creates a transport from a raw IRpcChannel by wrapping it in a RpcFrameMultiplexedChannel first.

Properties

connectionBuffer → IRpcConnectionBuffer
The connection-wide total of request bytes held un-consumed, or null when the transport keeps none.
latefinal
flowCredit → IRpcFlowCredit
Flow-control metering a higher layer can take over, or null when this transport does no flow control.
latefinal
grantsMessageCredit → bool
True: the channel protocol carries message credit.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
incomingMessages → Stream<RpcTransportMessage>
Stream of all incoming messages from the remote side.
no setteroverride
isClient → bool
True for client transport (generates odd Stream IDs), false for server transport (even Stream IDs).
no setteroverride
isClosed → bool
Returns true when the transport has been closed.
no setteroverride
lastIssuedStreamId → int
The stream id this transport handed out most recently.
no setteroverride
ready → Future<void>
Completes when the transport can carry calls, and with an error when it never will.
no setteroverride
reconnectOutcome → IRpcReconnectOutcome?
The outcome of this transport's next reconnect attempt, or null when it does not reconnect.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
securityPolicy → RpcSecurityPolicy
The limits this transport was configured with.
no setteroverride
supportsStreamIdResume → bool
Whether this transport implements lastIssuedStreamId and resumeStreamIdsAfter.
no setteroverride
supportsZeroCopy → bool
Whether the transport supports zero-copy operations (sendDirectObject).
no setteroverride

Methods

close() → Future<void>
Closes the transport connection and releases resources.
override
createStream() → int
Creates a new HTTP/2 stream for an RPC call.
override
finishSending(int streamId) → Future<void>
Finishes sending data for a stream.
override
getMessagesForStream(int streamId) → Stream<RpcTransportMessage>
Returns a filtered stream for a specific stream ID.
override
health() → Future<RpcHealthStatus>
Checks transport health and returns diagnostics.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
releaseStreamId(int streamId) → bool
Releases a stream ID so it can be reused later.
override
resetStream(int streamId, {String? reason}) → Future<bool>
Aborts streamId out of band, returning true when the reset was delivered.
inherited
resumeStreamIdsAfter(int streamId) → void
Continues the sequence after streamId.
override
sendDirectObject(int streamId, Object object, {bool endStream = false}) → Future<void>
ZERO-COPY: Sends an object directly without serialization (optional).
override
sendMessage(int streamId, Uint8List data, {bool endStream = false}) → Future<void>
Sends a framed message for a stream.
override
sendMetadata(int streamId, RpcMetadata metadata, {bool endStream = false}) → Future<void>
Sends metadata for a stream.
override
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

memoryPair({RpcSecurityPolicy policy = const RpcSecurityPolicy()}) → (RpcChannelTransport, RpcChannelTransport)
Creates a paired client/server transport over zero-copy in-memory channels.
pair({RpcSecurityPolicy policy = const RpcSecurityPolicy()}) → (RpcChannelTransport, RpcChannelTransport)
Creates a paired client/server transport over in-memory frame channels.