Event Structures
The ODIN Core SDK communicates key state changes and events through RPC (Remote Procedure Calls). These events are delivered to your application via the on_rpc callback in the OdinConnectionPoolSettings (see Quick Start).
The payload of these RPCs is encoded using MessagePack, which deserializes into a JSON-compatible structure. This page describes the JSON schema for the various events you will encounter.
Overview
All RPC events are delivered as a variant structure capable of representing different event types. The top-level structure typically differentiates between:
- Command Responses: Results of commands you sent.
- Room Updates: Changes to the room state (joins, leaves).
- Peer Updates: Changes to other peers (media start/stop).
- Message Received: Arbitrary data sent by other peers.
- Room Status Changed: Connection health updates.
Basic Structures
Media
Represents a media stream (audio/video).
Peer
Represents a user connected to the room.
Room
Represents the room itself.
Room Updates
These events are grouped under the RoomUpdated category.
Joined
Emitted when you successfully join a room and initial state is processed.
UserDataChanged (Room)
Emitted when the global room user data is updated.
Left
Emitted after being removed from a room (e.g., kicked or connection lost).
PeerJoined
Emitted when another peer joins the room.
PeerLeft
Emitted when a peer leaves the room.
Peer Updates
These events are grouped under the PeerUpdated category and relate to specific peers.
UserDataChanged (Peer)
Emitted when a peer updates their user data.
MediaStarted
Emitted when a peer starts a media stream (e.g., starts audio).
MediaStopped
Emitted when a peer stops a media stream.
TagsChanged
Emitted when a peer's tags are updated.
Other Events
MessageReceived
Emitted when an arbitrary message is received from a peer.
RoomStatusChanged
Emitted when the underlying connection status changes (e.g., "Connecting", "Online", "Offline").
Client Commands (RPC)
You can also send commands to the server via RPC.
UpdatePeer
Update your own user data.
UpdatePosition
Update your position in 3D space (for proximity chat).
Media Signaling
Control your media streams.
- StartMedia:
{ "media_id": uint16, "properties": object } - StopMedia:
{ "media_id": uint16 } - PauseMedia:
{ "media_id": uint16 } - ResumeMedia:
{ "media_id": uint16 }
SendMessage
Send arbitrary data to other peers.