Expand description
Control message types with encode/decode. Draft-18 control message encoding and decoding.
Key differences from draft-17:
Required Request ID Deltafield removed from every request message.- SUBSCRIBE_NAMESPACE renumbered to 0x50 and
subscribe_optionsremoved. - New SUBSCRIBE_TRACKS message (0x51); FORWARD parameter belongs here.
- PUBLISH_OK collapsed into REQUEST_OK (0x07); REQUEST_OK gains a trailing Track Properties block (length implicit from message length).
- GOAWAY gains an optional
request_id(control stream only). - REQUEST_ERROR gains REDIRECT (0x34) carrying a Redirect structure (connect_uri, track_namespace, track_name) appended after reason_phrase.
- PUBLISH_DONE status codes 0x5/0x6 swapped: 0x5 = TOO_FAR_BEHIND, 0x6 = EXPIRED.
- DELIVERY_TIMEOUT (0x02) renamed to OBJECT_DELIVERY_TIMEOUT; new SUBGROUP_DELIVERY_TIMEOUT (0x06) and FILL_TIMEOUT (0x0A).
- New TRACK_NAMESPACE_PREFIX parameter (0x34) for REQUEST_UPDATE (length-prefixed encoded TrackNamespace).
Re-exportsยง
pub use crate::error::CodecError;pub use crate::error::MAX_GOAWAY_URI_LENGTH;pub use crate::error::MAX_MESSAGE_LENGTH;pub use crate::error::MAX_NAMESPACE_TUPLE_SIZE;pub use crate::error::MAX_REASON_PHRASE_LENGTH;
Modulesยง
- publish_
done_ codes - Numeric values for the
PublishDone::status_codefield. - request_
error_ codes - REQUEST_ERROR error codes that gain dedicated meaning in draft-18.
Structsยง
- Fetch
- FetchOk
- FETCH_OK (0x18).
end_of_trackis uint8. - GoAway
- GOAWAY (0x10). Sent on the control stream (with
request_id) or on an individual request stream (withoutrequest_id). - Namespace
- Namespace
Done - Publish
- Publish
Blocked - Publish
Done - PUBLISH_DONE (0x0B). Status codes 0x5/0x6 are swapped vs draft-17.
- Publish
Namespace - Redirect
- Optional Redirect structure carried in REQUEST_ERROR with code 0x34.
- Request
Error - REQUEST_ERROR (0x05). Adds an optional Redirect structure when
error_codeis REDIRECT (0x34). - Request
Ok - REQUEST_OK (0x07). Used as a generic OK response and as the alias for PUBLISH_OK / REQUEST_UPDATE_OK / TRACK_STATUS_OK / SUBSCRIBE_NAMESPACE_OK / PUBLISH_NAMESPACE_OK.
- Request
Update - Setup
- Unified SETUP (0x2F00).
- Subscribe
- Subscribe
Namespace - SUBSCRIBE_NAMESPACE (0x50). Subscribes to NAMESPACE / NAMESPACE_DONE
advertisements for namespaces matching
namespace_prefix. Thesubscribe_optionsbyte from draft-17 is removed; namespace subscriptions only produce NAMESPACE / NAMESPACE_DONE. - Subscribe
Ok - SUBSCRIBE_OK (0x04).
- Subscribe
Tracks - SUBSCRIBE_TRACKS (0x51, new in draft-18). Subscribes to PUBLISH messages
for tracks whose namespace matches
namespace_prefix. Carries the FORWARD parameter (which previously lived on SUBSCRIBE_NAMESPACE). - Track
Status
Enumsยง
- Control
Message - Fetch
Payload - Fetch
Type - Message
Type - Param
Encoding ๐ - How a parameter value is encoded on the wire.
Functionsยง
- decode_
kvp_ ๐delta - Decode delta-encoded KVPs with even/odd convention (for setup options and track properties). Read until buffer is exhausted.
- decode_
parameters ๐ - Decode a count-prefixed list of parameters with delta-encoded types.
- encode_
kvp_ ๐delta - Encode delta-encoded KVPs with even/odd convention.
- encode_
parameters ๐ - Encode a count-prefixed list of parameters with delta-encoded types.
- param_
encoding ๐