Skip to main content

Module messages

Module messages 

Source
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§

AudioChunkHeader
The fixed header of a player audio chunk, the binary message with id AUDIO_CHUNK_ID.
ClientCommand
client/command: a command the client sends to the server for one of its active roles.
ClientGoodbye
client/goodbye: why the client is closing the connection.
ClientHello
client/hello: the client’s roles and capabilities.
ClientInit
client/init: the client’s opening message on a connection.
ClientPairAuth
client/pair-auth: the client’s CPace public share Yb.
ClientPairConfirm
client/pair-confirm: the client’s MCF tag Tb, plus the dynamic flow’s sealed opening.
ClientPairFinalize
client/pair-finalize: the long-term PSK this pairing establishes.
ClientPairInit
client/pair-init: starts a pairing attempt.
ClientPairPending
client/pair-pending: the client is holding the admitted attempt back.
ClientPairRetry
client/pair-retry: asks for another round of the dynamic flow.
ClientState
client/state: client availability plus the state of each active role.
ClientTime
client/time: a clock-synchronization request.
ControllerCommand
The controller object of ClientCommand.
ControllerState
The controller object of ServerState.
DeviceInfo
The device_info object of ClientHello.
DynamicPairingCodeMethod
The dynamic_pairing_code descriptor of SupportedPairMethods.
GroupUpdate
group/update: the state and identity of the group this client is part of.
Metadata
The metadata object of ServerState.
NoiseHandshake
noise/handshake: one Noise handshake message.
PairAbort
pair/abort: ends a pairing attempt, whether or not it started.
PairingActivation
The pairing object of ServerActivate.
PairingPskMethod
The pairing_psk descriptor of SupportedPairMethods.
PlayerCommand
The player object of ServerCommand.
PlayerState
The player object of ClientState.
PlayerSupport
The player@v1_support object of ClientHello.
Progress
The progress object of Metadata. Times and durations are milliseconds.
ServerActivate
server/activate: the server’s purpose on this connection and the active roles.
ServerCommand
server/command: a command for one of the client’s active roles.
ServerError
server/error: the server rejected the client’s ClientInit and closes the connection.
ServerHello
server/hello: the server’s identity, the first message after the handshake.
ServerInit
server/init: the server’s answer to ClientInit.
ServerPairAuth
server/pair-auth: the server’s CPace public share Ya.
ServerPairConfirm
server/pair-confirm: the server’s MCF tag Ta.
ServerPairFinalize
server/pair-finalize: the server persisted its pairing record.
ServerPairInit
server/pair-init: begins a round of the Dynamic Pairing Code Flow.
ServerState
server/state: the state of each active server role.
ServerTime
server/time: the reply to ClientTime, carrying the four timestamps of one measurement.
ServerUnpair
server/unpair: the server dropped its pairing record for this client.
StaticPairingCodeMethod
The static_pairing_code descriptor of SupportedPairMethods.
StreamClear
stream/clear: drops buffered data without ending the stream.
StreamEnd
stream/end: ends one or more streams.
StreamStart
stream/start: announces a stream and its format.
StreamStartPlayer
The player object of StreamStart: the negotiated audio format of a stream.
SupportedFormat
One audio format a player advertises in PlayerSupport::supported_formats.
SupportedPairMethods
The supported_pair_methods object of ClientHello, keyed by method identifier.
UnpairedAccess
The unpaired_access object of ClientHello.

Enums§

DecodeError
Why a text frame did not produce an Incoming message.
Incoming
One decoded JSON message, classified by its type field.

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/init and server/init.