CapabilityHandshake class

The compatibility handshake exchanged before any graph state flows (protocol.md § Capability Negotiation).

Serialized as a plain JSON object (NOT externally tagged — this is a standalone frame, not an IpcMessage variant):

{
  "protocol_id": "lazily-ipc",
  "protocol_major_version": 1,
  "codec": "json",
  "max_frame_size": 1048576,
  "fragmentation_supported": false,
  "ordered_reliable": true,
  "peer_id": 1,
  "session_id": "abc-123",
  "features": ["shared-blob", "signaling-relay"]
}

Constructors

CapabilityHandshake({required PeerId peerId, required String sessionId, String? protocolId, int? protocolMajorVersion, String? codec, int? maxFrameSize, bool fragmentationSupported = false, bool orderedReliable = true, List<String>? features})
CapabilityHandshake.defaults(PeerId peerId, String sessionId)
Create a handshake with protocol defaults (JSON codec, 1 MiB frame, ordered-reliable, no features).
factory

Properties

codec String
final
features List<String>
final
fragmentationSupported bool
final
hashCode int
The hash code for this object.
no setterinherited
maxFrameSize int
final
orderedReliable bool
final
peerId int
final
protocolId String
final
protocolMajorVersion int
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sessionId String
final

Methods

checkCompatible(CapabilityHandshake other, {Iterable<String> requiredFeatures = const []}) CapabilityCheck
Structured compatibility check. Returns the offending field (and reason) on mismatch so a caller can produce a clean fail-closed diagnostic — mirrors lazily-js::SessionHandshake.checkCompatible.
encodeJson() String
UTF-8 JSON bytes of toWire.
hasFeature(String feature) bool
Whether this peer advertises feature.
isCompatibleWith(CapabilityHandshake other) bool
Whether this handshake is mutually compatible with other.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override
toWire() Map<String, Object>
The plain-JSON wire shape (a standalone frame, NOT externally tagged).
withCodec(String codec) CapabilityHandshake
Builder: set the codec negotiation token.
withFeatures(Iterable<String> features) CapabilityHandshake
Builder: set the features list.
withFragmentation(bool supported) CapabilityHandshake
Builder: set fragmentation support.
withMaxFrameSize(int maxFrameSize) CapabilityHandshake
Builder: set the max frame size.
withOrderedReliable(bool orderedReliable) CapabilityHandshake
Builder: set ordered-reliable.

Operators

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

Static Methods

decodeJson(Object data) CapabilityHandshake
Decode UTF-8 JSON bytes (or a JSON string) into a handshake.
fromWire(Object? value) CapabilityHandshake
Decode a plain-JSON wire object. Defaults fragmentation_supported = false, ordered_reliable = true, features = [] when absent (mirrors the lazily-rs serde defaults).