Internals
The wire protocol, codec architecture, adaptor and decoder 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 adaptor and decoder 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 adaptor 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. - Adaptor and decoder: the SDK's two parts. The adaptor's pipe writer appends streams and repairs failed appends, and the decoder delivers every message through the codec.