ControlMessageCodec class

Encodes handshake ControlMessages to and from the JSON envelope {"type": <type>, ...fields}, carried as WebSocket text frames.

Centralizes the typefromJson dispatch so adding a handshake message means registering it in one place. Only the handshake rides this codec — everything after it is omnyhub's node protocol on its own codec.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

decode(Map<String, dynamic> json) ControlMessage
Decodes a JSON object into a ControlMessage.
encode(ControlMessage message) Map<String, dynamic>
Encodes message to a JSON object, injecting type.
fromWire(Message message) ControlMessage
Decodes an omnyhub Message from the wire.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
toWire(ControlMessage message) → Message
Encodes message as an omnyhub text Message for the wire.

Operators

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

Constants

instance → const ControlMessageCodec
The shared codec instance.