Skip to main content
The voice system enables real-time voice communication through voice rooms, allowing users to join channels for voice chat with multiple participants.

Overview

Voice functionality is provided through the tangle.client.voice package, which manages voice rooms, participant state, and real-time updates.

Requesting a Voice Room

To join or create a voice room for a chat, use the RequestRoom message.

RequestRoom

This message requests access to a voice room for a specific chat.
chat_ref
refs.ChatRef
required
Reference to the chat for which to request a voice room

Protocol Definition

// voice.requestRoom -> RoomInfo
message RequestRoom {
  refs.ChatRef chat_ref = 1;
}

Response: RoomInfo

The server responds with RoomInfo containing connection details.
room_id
fixed64
required
Snowflake ID of the voice room
chat_ref
refs.ChatRef
required
Reference to the chat this room belongs to
endpoint
string
required
WebRTC endpoint URL for connecting to the voice room

Protocol Definition

message RoomInfo {
  // @snowflake
  fixed64 room_id = 1;
  refs.ChatRef chat_ref = 2;
  string endpoint = 3;
}

Room Participants

The RoomParticipant message represents a user connected to a voice room.
room_id
fixed64
required
Snowflake ID of the room
connection_id
fixed64
required
Unique connection ID for this participant’s session
user_id
fixed64
required
Snowflake ID of the user
muted
bool
required
Whether the participant has their microphone muted
deafened
bool
required
Whether the participant has deafened themselves (cannot hear others)

Protocol Definition

message RoomParticipant {
  // @snowflake
  fixed64 room_id = 1;
  fixed64 connection_id = 2;
  // @snowflake<User>
  fixed64 user_id = 3;
  bool muted = 4;
  bool deafened = 5;
}

Room State

The RoomState message provides a complete snapshot of a voice room’s state.
room_id
fixed64
required
Snowflake ID of the room
participants
RoomParticipant[]
required
Array of all participants currently in the room

Protocol Definition

message RoomState {
  // @snowflake
  fixed64 room_id = 2;
  repeated RoomParticipant participants = 3;
}

Real-Time Updates

Update Room State

The UpdateRoomState message is sent by the server to notify clients of room state changes.
chat_ref
refs.ChatRef
required
Reference to the chat containing the room
state
RoomState
required
Complete current state of the room

Protocol Definition

message UpdateRoomState {
  refs.ChatRef chat_ref = 1;
  RoomState state = 2;
}

Update Room Participant

The UpdateRoomParticipant message is sent when a participant’s state changes.
connection_id
fixed64
required
Connection ID of the participant being updated
chat_ref
refs.ChatRef
required
Reference to the chat containing the room
user_id
fixed64
required
Snowflake ID of the user
muted
bool
required
Updated mute status
deafened
bool
required
Updated deafen status

Protocol Definition

message UpdateRoomParticipant {
  fixed64 connection_id = 1;
  refs.ChatRef chat_ref = 2;
  // @snowflake<User>
  fixed64 user_id = 3;
  bool muted = 4;
  bool deafened = 5;
}

Usage Flow

  1. Request Room: Client sends RequestRoom with the desired chat reference
  2. Receive Room Info: Server responds with RoomInfo containing the WebRTC endpoint
  3. Connect: Client connects to the WebRTC endpoint using the provided URL
  4. Receive Updates: Client receives UpdateRoomState and UpdateRoomParticipant messages as the room state changes
  5. Monitor Participants: Track who is in the room and their mute/deafen status through the update messages
The muted state indicates the user has disabled their microphone, while deafened indicates they cannot hear other participants. A deafened user is typically also muted.

Build docs developers (and LLMs) love