Message Reference

Terse lookup for the MeshSocket wire format. For narrative, read The MeshSocket Protocol and Data Flow — sync & actions.

Frame

{ "id": "uuid", "type": "string", "payload": <any>, "reply_to": "uuid | null" }

reply_to is set only when answering a request (echo the request's id).

Verbs

type Direction Payload Notes
identify client → relay { name, channel, role, can_broadcast?, can_route?, can_monitor?, broadcast_scope?, auth_token? } Sent on connect; joins a channel
welcome relay → client { id, name } Admission confirmation
broadcast_request client → relay <any> (convention: { msg_type, … }) Asks the relay to fan out
broadcast relay → clients the broadcast payload What receivers listen for
route_msg client → relay { target_id \| target_name, type, payload } Point-to-point request; returns the target's reply
route_msg_noreply client → relay { target_name, type, payload } Point-to-point fire-and-forget
get_nodes client → relay null Returns { clients: [...] } (needs can_monitor)
server_client_list relay → client { clients: [{ id, name, channel, role }] } Roster push to monitors on change*

* The roster push fires during a member's identify, before that member is fully registered, so it can omit a peer that just joined. To reliably detect a peer appearing, poll get_nodes instead of waiting on the push.

Identify fields

Field Type Default Meaning
name string Display name + routing handle (target_name)
channel string "default" Channel to join
role string "node" Role label; sets capability defaults
can_broadcast bool role-based May send broadcast_request
can_route bool role-based May send route_msg / route_msg_noreply
can_monitor bool role-based Receives roster; may call get_nodes
broadcast_scope "global"/"channel" channel (global if monitor) Broadcast reach
auth_token string "" Gateway token; empty for self-hosted

Request / response

  • request(type, payload) → send a frame, await a frame whose reply_to matches its id; ~5s default timeout.
  • To answer: return a value from the handler registered for that type (the client library wraps it); or, in raw form, send a frame with reply_to set to the request's id.

Layout-side mapping

How layout JSON maps to verbs (see Data Flow — sync & actions):

Layout field Becomes
sync.event = "broadcast" + filter + valuePath listen for broadcast; match filter; extract valuePath
sync.event = "<custom>" listen for frames of type:"<custom>" (server must route them)
action.event = "broadcast_request" device sends broadcast_request (fan-out)
action.event = "route_msg" + mode:"request" device sends a routed request, awaits reply
action.mode = "request" await reply; else fire-and-forget
"{{value}}" in action.payload substituted with the control's value (native type if exact token)

See also Layout Schema and Glossary.