voice_join
Join a voice channel. The server tracks who is in the channel and hands out each participant’s peer ID. It does not carry audio or relay signalling. Your client connects to the other participants itself, using a peer-to-peer service such as PeerJS, and the peer ID is your address on that service.
Request
Section titled “Request”{ "cmd": "voice_join", "channel": "hangout", "peer_id": "3f9c2a71-5d0e-4b8f-9a61-7c2e4d1b8e05"}| Field | Type | Required | Description |
|---|---|---|---|
channel |
string | Yes | Name of a voice channel you can view. Surrounding spaces are trimmed. |
peer_id |
string | Yes | Your ID on the peer-to-peer service. Other participants use it to call you. Surrounding spaces are trimmed; must not be empty. |
Response
Section titled “Response”{ "cmd": "voice_join", "channel": "hangout", "peer_id": "3f9c2a71-5d0e-4b8f-9a61-7c2e4d1b8e05", "participants": [ { "username": "alice", "peer_id": "b27e0c44-19a3-4f6d-8c55-0e9d3a7f2c18", "muted": false }, { "username": "bob", "peer_id": "e81d5f02-6c7b-4a9e-b3d4-51a0c9f6e7a2", "muted": true } ]}participants lists everyone who was already in the channel, not including you. Connect to each peer_id to start audio. These entries have no id field, unlike voice_state. Users severed from you are left out.
The voice_user_joined event
Section titled “The voice_user_joined event”When you join, the server sends this event to every connection whose user can view the channel, including your own connections:
{ "cmd": "voice_user_joined", "channel": "hangout", "user": { "id": "usr_8f2k1", "username": "carol", "muted": false, "peer_id": "3f9c2a71-5d0e-4b8f-9a61-7c2e4d1b8e05" }}user.peer_idis sent only to users who are in the channel. Viewers who aren’t in it getid,username, andmuted.- Users severed from the joiner don’t get the event.
- The event is sent before the
voice_joinresponse, so the joining connection sees its ownvoice_user_joinedfirst.
Existing participants should connect to the new peer_id, or wait for the newcomer to call them. The server doesn’t decide who calls whom.
Switching and rejoining
Section titled “Switching and rejoining”- A connection can be in one voice channel at a time. Joining another channel leaves the current one first, which sends
voice_user_leftfor the old channel. - Joining the channel you are already in, from the same connection, leaves and rejoins it. Use this to change your
peer_id. - One account can be in a given channel from only one connection. A second device gets an error until the first one leaves.
- Voice state lives in memory. A server restart clears it; rejoin after reconnecting.
Severed users
Section titled “Severed users”A moderator can sever two users with the /sever slash command so they no longer see each other. In voice, severed users are hidden from each other’s participant lists and events, but can still be in the same channel.
Permissions
Section titled “Permissions”You must be able to view the channel. No other permission is checked. A user in timeout gets a rate_limit frame instead.
Errors
Section titled “Errors”val |
When |
|---|---|
channel: Required |
channel is missing. The same pattern applies to peer_id. |
peer_id: Expected length at least 1 |
channel or peer_id is empty after trimming. |
This is not a voice channel |
The channel doesn’t exist or isn’t a voice channel. |
You do not have permission to access this voice channel |
You can’t view the channel. |
You are already connected to this voice channel on another device |
Your account is already in this channel from another connection. |
