Internals
The wire protocol, codec architecture, and transport patterns that AI Transport is built from. For senior engineers and codec implementers.
The internals section is for engineers who want to understand the system before they depend on it, and for anyone building a custom codec.
Three layers fit together, from the messages on the channel up to the transport your application calls:
- Wire protocol: what AI Transport writes on the Ably channel. A codec's event type and fields go under
extras.ai, the transport marks the messages of a stream and the message that ends one, and the headers of eachsend()orpipe()call go underextras.headers. - Codec architecture: how a codec encodes events to Ably messages and decodes them back.
defineCodecbuilds a codec from a table of rows, and the decoder core reduces live appends, full-content updates and history reads to the text each delivery adds. - Transport patterns: the transport's internal parts. The pipe writer appends streams and repairs failed appends, the subscription delivers every message through the codec, the history replay buffers live messages, and the continuity watcher reports discontinuities.
Topics
Wire protocol
The Ably channel wire format: the extras fields, streamed and plain messages, and headers.
Codec architecture
How a codec maps events to Ably messages, and how the decoder core handles appends, updates and history.
Transport patterns
The pipe writer, delivery, the history replay buffer, and the continuity watcher.