Overview
Voice functionality is provided through thetangle.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 theRequestRoom message.
RequestRoom
This message requests access to a voice room for a specific chat.Reference to the chat for which to request a voice room
Protocol Definition
Response: RoomInfo
The server responds withRoomInfo containing connection details.
Snowflake ID of the voice room
Reference to the chat this room belongs to
WebRTC endpoint URL for connecting to the voice room
Protocol Definition
Room Participants
TheRoomParticipant message represents a user connected to a voice room.
Snowflake ID of the room
Unique connection ID for this participant’s session
Snowflake ID of the user
Whether the participant has their microphone muted
Whether the participant has deafened themselves (cannot hear others)
Protocol Definition
Room State
TheRoomState message provides a complete snapshot of a voice room’s state.
Snowflake ID of the room
Array of all participants currently in the room
Protocol Definition
Real-Time Updates
Update Room State
TheUpdateRoomState message is sent by the server to notify clients of room state changes.
Reference to the chat containing the room
Complete current state of the room
Protocol Definition
Update Room Participant
TheUpdateRoomParticipant message is sent when a participant’s state changes.
Connection ID of the participant being updated
Reference to the chat containing the room
Snowflake ID of the user
Updated mute status
Updated deafen status
Protocol Definition
Usage Flow
- Request Room: Client sends
RequestRoomwith the desired chat reference - Receive Room Info: Server responds with
RoomInfocontaining the WebRTC endpoint - Connect: Client connects to the WebRTC endpoint using the provided URL
- Receive Updates: Client receives
UpdateRoomStateandUpdateRoomParticipantmessages as the room state changes - 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.