RpcTransportMessage class final
Transport-layer message with Stream ID support.
Represents payload and metadata traveling over a transport and bound to a specific HTTP/2 stream (an RPC call).
ZERO-COPY OPTIMIZATION: Supports passing objects directly without serialization for in-memory transports.
Constructors
- RpcTransportMessage({Uint8List? payload, Object? directPayload, RpcMetadata? metadata, bool isEndOfStream = false, String? methodPath, required int streamId})
- Creates a transport message.
- RpcTransportMessage.withDirectObject({required Object directPayload, RpcMetadata? metadata, bool isEndOfStream = false, String? methodPath, required int streamId})
-
Factory for direct-object message (zero-copy mode).
factory
- RpcTransportMessage.withMetadata({required RpcMetadata metadata, bool isEndOfStream = false, String? methodPath, required int streamId})
-
Factory for metadata-only message.
factory
- RpcTransportMessage.withPayload({required Uint8List payload, RpcMetadata? metadata, bool isEndOfStream = false, String? methodPath, required int streamId})
-
Factory for serialized-payload message (standard mode).
factory
Properties
- bufferedBytes → int
-
What this message weighs while it is held in a queue, in bytes.
no setter
- directPayload → Object?
-
ZERO-COPY: Direct reference to an object (for in-memory transport).
Use only inside a single process.
Object must be immutable or cloned.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDirect → bool
-
True when a direct object is being sent (zero-copy optimization).
no setter
- isEndOfStream → bool
-
Whether this is the final message in the stream.
final
- isMetadataOnly → bool
-
True when the message contains only metadata.
no setter
- isSerialized → bool
-
True when serialized bytes are present.
no setter
- metadata → RpcMetadata?
-
Associated metadata.
final
- methodPath → String?
-
Method path in
/ServiceName/MethodNameformat.final - payload → Uint8List?
-
Serialized payload bytes.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- streamId → int
-
HTTP/2 stream identifier for this RPC call.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited