FrameCodec class
Encodes and decodes OmnyShellFrames to and from WebSocket events.
Control messages map to JSON text frames {"t":..,"c":..,"d":..}; stream
data maps to binary frames with a fixed 10-byte header (version, opcode,
channel id, payload length) followed by the raw bytes. The control decoder
set is extensible via register, so third-party packages can add message
types over the same transport.
Constructors
- FrameCodec.standard()
-
Creates a codec pre-registered with all built-in control messages.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
registeredTypes
→ Iterable<
String> -
The control types this codec can decode.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
decode(
Object event) → OmnyShellFrame -
Decodes a raw WebSocket
event(a String text frame orList<int>binary frame) into an OmnyShellFrame. -
decodeControl(
String text) → ControlFrame -
Decodes a JSON envelope
textinto a ControlFrame. -
decodeData(
List< int> bytes) → DataFrame -
Decodes
bytes(header + payload) into a DataFrame. -
encode(
OmnyShellFrame frame) → Object -
Encodes
frameinto the value to add to a WebSocket sink: a String for control frames or a Uint8List for data frames. -
encodeControl(
ControlMessage message) → String -
Encodes a control
messageinto a JSON envelope string. -
encodeData(
DataFrame frame) → Uint8List -
Encodes a
frameinto its 10-byte header + payload bytes. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
register(
String type, ControlDecoder decoder) → void -
Registers a
decoderfor a custom control messagetype. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- headerSize → const int
- The fixed binary data-frame header size, in bytes.
- maxDataPayload → const int
- The maximum payload a single data frame may carry (64 KiB). Senders split larger writes; receivers reject anything larger as malformed.