Expand description
Sendspin wire messages.
Every JSON message is an envelope of the form {"type": "<group>/<name>", "payload": {..}}.
Incoming classifies one such envelope: deserializing it reads type and parses payload
into the matching struct, and serializing a variant writes the envelope back, so a session
needs one type for both directions.
The opening messages of a connection — client/init, server/init and noise/handshake —
travel as cleartext text before the Noise handshake; every later JSON message travels inside a
Noise transport message with binary message id 0. The structs here do not know which phase
they belong to.
Parsing is lenient in the direction a receiver needs it: unknown fields are ignored, and
fields the specification allows to be absent default. A type this revision does not define
is an error, never a silent default, so the caller decides whether to ignore the message.
Structs§
- Audio
Chunk Header - The fixed header of a player audio chunk, the binary message with id
AUDIO_CHUNK_ID. - Client
Command client/command: a command the client sends to the server for one of its active roles.- Client
Hello client/hello: the client’s roles and capabilities.- Client
Init client/init: the client’s opening message on a connection.- Client
Pair Auth client/pair-auth: the client’s CPace public shareYb.- Client
Pair Confirm client/pair-confirm: the client’s MCF tagTb, plus the dynamic flow’s sealed opening.- Client
Pair Finalize client/pair-finalize: the long-term PSK this pairing establishes.- Client
Pair Init client/pair-init: starts a pairing attempt.- Client
Pair Pending client/pair-pending: the client is holding the admitted attempt back.- Client
Pair Retry client/pair-retry: asks for another round of the dynamic flow.- Client
State client/state: client availability plus the state of each active role.- Client
Time client/time: a clock-synchronization request.- Controller
Command - The
controllerobject ofClientCommand. - Controller
State - The
controllerobject ofServerState. - Device
Info - The
device_infoobject ofClientHello. - Dynamic
Pairing Code Method - The
dynamic_pairing_codedescriptor ofSupportedPairMethods. - Metadata
- The
metadataobject ofServerState. - Noise
Handshake noise/handshake: one Noise handshake message.- Pair
Abort pair/abort: ends a pairing attempt, whether or not it started.- Pairing
Activation - The
pairingobject ofServerActivate. - Pairing
PskMethod - The
pairing_pskdescriptor ofSupportedPairMethods. - Player
Command - The
playerobject ofServerCommand. - Player
State - The
playerobject ofClientState. - Player
Support - The
player@v1_supportobject ofClientHello. - Progress
- The
progressobject ofMetadata. Times and durations are milliseconds. - Server
Activate server/activate: the server’s purpose on this connection and the active roles.- Server
Command server/command: a command for one of the client’s active roles.- Server
Hello server/hello: the server’s identity, the first message after the handshake.- Server
Init server/init: the server’s answer toClientInit.- Server
Pair Auth server/pair-auth: the server’s CPace public shareYa.- Server
Pair Confirm server/pair-confirm: the server’s MCF tagTa.- Server
Pair Finalize server/pair-finalize: the server persisted its pairing record.- Server
Pair Init server/pair-init: begins a round of the Dynamic Pairing Code Flow.- Server
State server/state: the state of each active server role.- Server
Time server/time: the reply toClientTime, carrying the four timestamps of one measurement.- Server
Unpair server/unpair: the server dropped its pairing record for this client.- Static
Pairing Code Method - The
static_pairing_codedescriptor ofSupportedPairMethods. - Stream
Clear stream/clear: drops buffered data without ending the stream.- Stream
End stream/end: ends one or more streams.- Stream
Start stream/start: announces a stream and its format.- Stream
Start Player - The
playerobject ofStreamStart: the negotiated audio format of a stream. - Supported
Format - One audio format a player advertises in
PlayerSupport::supported_formats. - Supported
Pair Methods - The
supported_pair_methodsobject ofClientHello, keyed by method identifier. - Unpaired
Access - The
unpaired_accessobject ofClientHello.
Enums§
- Decode
Error - Why a text frame did not produce an
Incomingmessage. - Incoming
- One decoded JSON message, classified by its
typefield.
Constants§
- AUDIO_
CHUNK_ ID - Binary message id of a player audio chunk.
- NOISE_
SUITE - Noise cipher suite name carried by
client/init. - PROTOCOL_
VERSION - Core message format version carried by
client/initandserver/init.