Skip to main content
Clody lets you jump straight from a Branch text chat into a voice call with the same members. Calls are powered by Socket.IO over the dedicated /bcalls namespace and coordinated through a lightweight REST layer that provisions tokens and lists available servers. This guide covers everything from starting your first call to sharing your screen and hanging up.

Prerequisites

  • You must be a member of the Branch you want to call.
  • Connect to the /bcalls Socket.IO namespace (in addition to the main / namespace).
  • Your session cookie must be valid.
Only one active call can exist per Branch at a time. If a call is already in progress, you will receive an error if you try to start a second one.

Step 1 — Get Available Voice Servers

GET /api/calls/servers Retrieve the list of available regional voice servers before starting a call. You can optionally pass the preferred server when you emit start_call.
Response:

Step 2 — Get a Call Token

POST /api/calls/token Obtain a signed token that your WebRTC layer uses to authenticate with the voice server.
Response:

Step 3 — Connect to the /bcalls Namespace

Step 4 — Start a Call

Emit start_call on the main / namespace (socket) with the Branch ID. Optionally pass a server_addr from the servers list to route the call to a specific region.
start_call is emitted on the main / namespace, not on /bcalls. All other call-control events (join_call, leave_call, mic_toggle, etc.) are emitted on callSocket (/bcalls).
All other Branch members receive a new_call event on the main / namespace with the same Call object.

Step 5 — Join an Incoming Call

When another member starts a call, you receive new_call on the main namespace. Join by emitting join_call on the /bcalls namespace:
You move from the waiting list to the members list in the Call object, and all participants receive an update event.

Step 6 — Reject an Incoming Call

If you do not want to join, emit reject_call to dismiss the notification:

Step 7 — Manage Your Microphone

Toggle mute state with mic_toggle. When off is true you are muted; false un-mutes you:
Your user ID appears in the call’s mic_off array when you are muted. All participants receive an update event.

Step 8 — Share Your Screen

Start screen sharing with toggle_screen_sharing:
Your user ID becomes a key in the call’s sharing_screen object. The value is an array of participant IDs who are currently watching your stream.

Step 9 — Watch Someone’s Screen Share

Express intent to watch a specific participant’s screen with toggle_watching_screen_sharing:
The author must currently be sharing their screen. If they are not, you will receive an error event.

Step 10 — Leave the Call

If you are the last participant, the server tears down the call and emits stop_call ({id: 12}) to any users still in the waiting list.

Call State Object

Every update, started_call, and new_call event carries a Call object:
number
The Branch ID the call belongs to.
array of numbers
User IDs of participants currently in the call.
array of numbers
User IDs of Branch members who have been invited but have not yet joined.
array of numbers
User IDs of participants who are currently muted.
object
Map of user_id → [watcher_ids]. Each key is a participant sharing their screen; the value is the list of participants watching them.
string or null
The voice server hostname this call is routed through, if one was specified at start time.

Get the Current Call State via REST

If you need to poll the call state (for example, on page load), use POST /api/calls/get:
Returns the Call object, or null if no call is active in that Branch.

Full Flow Example

Error Reference