Skip to main content

Module frame

Module frame 

Source
Expand description

Framing (spec: Framed self-describing messages): every message travels as a 32-bit big-endian payload length followed by exactly one CBOR item of that length.

The limit applies to the payload length. Before the handshake each side uses its own configured maximum; afterwards both use the negotiated one, the smaller of the two sides’ maxima.

Structs§

FrameDecoder
Splits a byte stream into frame payloads, buffering partial frames.
FrameTooLarge
A message whose payload is larger than the frame limit, refused by the sender.
Oversized
An incoming frame whose declared length exceeds the limit. Its payload is discarded, never delivered; the kind and request id come from its first bytes when they can be read.

Constants§

DEFAULT_MAX_FRAME
The default maximum frame payload: 16 MiB, room for a full-resolution PNG screenshot, as agent-device’s bridge allows.
HEADER_LEN
Bytes in a frame header.
MIN_MAX_FRAME
The smallest maximum frame payload a side may negotiate: 4 KiB, so that hellos, errors and pings always fit.

Functions§

write_frame
Appends msg to out as one frame. Refuses a payload larger than limit, leaving out as it was.