Documentation Index
Fetch the complete documentation index at: https://mintlify.com/moqtail/moqtail/llms.txt
Use this file to discover all available pages before exploring further.
ClientSetup
TheClientSetup message is sent by the client during the MOQT handshake to negotiate protocol version and capabilities with the server.
Overview
ClientSetup is the first control message sent over the bidirectional control stream after establishing a WebTransport connection. It contains:- A list of supported protocol versions (in preference order)
- Optional setup parameters for capability negotiation
ServerSetup message selecting one of the offered versions and providing its own parameters.
ClientSetup Class
Constructor
Ordered list of MOQT protocol version numbers the client supports. The server will select one from this list.Common versions:
0xff00000e(4278190094) - MOQT Draft-14 (current)0xff00000b(4278190091) - MOQT Draft-11
Array of key-value pairs containing setup parameters. Use
SetupParameters builder for convenience.Methods
serialize()
Serializes the ClientSetup message to a wire format.
Serialized message ready for transmission
LengthExceedsMaxError- If payload length exceeds 65535 bytes
parsePayload()
Parses a ClientSetup message from a buffer.
Buffer containing the serialized ClientSetup payload
Parsed ClientSetup instance
SetupParameters Builder
TheSetupParameters class provides a fluent API for building setup parameter lists.
Constructor
Methods
addMaxRequestId()
Sets the maximum request ID the client will use.
Maximum request ID value (must be >= 0)
The builder instance for chaining
0x00
addMaxAuthTokenCacheSize()
Sets the maximum number of authorization tokens to cache.
Maximum cache size (must be >= 0)
The builder instance for chaining
0x01
addRole()
Sets the client’s role in the MOQT session.
Client role:
Role.Publisher(0x01) - Can publish tracksRole.Subscriber(0x02) - Can subscribe to tracksRole.PubSub(0x03) - Can both publish and subscribe
The builder instance for chaining
0x00 (in version-specific parameters)
build()
Builds the final parameter array.
Array of key-value pairs ready for use in ClientSetup
Usage Examples
ServerSetup Response
After sending ClientSetup, the client receives aServerSetup message containing:
Setup Parameter Keys
Common Setup Parameters
| Key | Name | Type | Description |
|---|---|---|---|
0x00 | MAX_REQUEST_ID | VarInt | Maximum request ID client will use |
0x01 | MAX_AUTH_TOKEN_CACHE_SIZE | VarInt | Maximum authorization tokens to cache |
Version-Specific Parameters
These parameters are nested within setup parameters:| Key | Name | Type | Description |
|---|---|---|---|
0x00 | ROLE | VarInt | Client role (Publisher=1, Subscriber=2, PubSub=3) |
Protocol Flow
Best Practices
Role Parameter: Setting the role parameter helps relays optimize resource allocation. Use
Role.Publisher if you only publish, Role.Subscriber if you only subscribe, or Role.PubSub if you do both.See Also
- MOQtailClient - Main client class
- VersionSpecificParameters - Request-level parameters
- MOQT Protocol Draft-14 - Official specification