Three or four people can talk in one voice Room, each from their own browser. A Room holds up to four people. LiveKit carries the audio, and OneSay decides who may join, speak and listen: the server checks every step, whatever the client sends. The Console has a ready-made Voice room panel that walks you through these steps. This page explains them, so that you can build the same flow in your own application.
This is a preview with a fixed group. Read the current limits at the end of this page before you invite people.
What you need
- A Project Environment, and an Application in it.
- For each person: their own OneSay sign-in through your application, which gives a short-lived Human token (never put an API key in a browser), and a microphone Source.
- For each person, these Grants in that Project Environment:
room.read,participant.read,livekit.room_join,source.use,livekit.publish:microphone,livekit.subscribe,app.session.createandapp.session.close. The person who creates the Room also needsroom.createandroom.close.
Steps
Each person walks these steps in order. Join one at a time: wait until the previous person appears in the participant list (listRoomParticipants; in the Console, under Who is here) before you join; people who join or start listening at the same moment can fail to connect or stay unheard.
- Create or join the Room. One person creates it with
POST /rooms(createRoom), withmax_participantsset to the group size (3 or 4), and shares itsroom_id. The others read it withGET /rooms/{room_id}(getRoom) to check that it is open and has not started. - Start an app session with
POST /app-sessions(createAppSession) for your Application. - Connect with the SDK's
client.rtc.connect(createRTCConnection), passingmicrophoneSourceIdso connection admission covers your microphone and returnssession.microphonePublicationId. Nobody is heard yet. - Publish your microphone with
session.audio.publishLocalMicrophone(), which captures and publishes directly to LiveKit with no extra server call. - Let the next person join. The next person starts step 3 only when you appear in the participant list (step 6).
- Read the roster.
GET /rooms/{room_id}/participants(listRoomParticipants) lists who is in the Room, andGET /rooms/{room_id}/signals(listRoomSignals) lists their audio. A person is speaking when one of their signals has the profileaudio.rtc.v1and the statusactive. Name onlyactivesignals: apendingone is not published yet. A participant'sstatusis OneSay's admission state on its current connection; itspresence(present,absentorunknown) says whether it is in the voice session now. - Turn on sound with
session.audio.enablePlayback(), called from the person's own click, as browsers require. In JavaScript SDKv0.2.0,session.capabilities.autoSubscribeistrueunder LiveKit's stock auto-subscribe defaults, so LiveKit delivers every other member's audio as they publish with no separate subscription request (see Listening at the join below). - Leave. Stop local microphone capture with
microphone.stop()(or end the publication server-side withclient.rtc.endPublication/endRTCPublication, which needs no confirmation since it is your own), then leave withsession.close(), which disconnects you through LiveKit and needs no confirmation. When LiveKit reports that you left (participant_left) and you have not reconnected within about a minute, the server ends the connection and frees your place in the Room. Then close the app session (closeAppSession). The creator may also close the Room (closeRoom).
JavaScript
This sketch uses only the JavaScript SDK's public interface (@onesay/sdk v0.2.0). To ask for access to the SDK, write to sdk@onesay.com. humanToken, the ids and the
idempotency keys come from your application; keep each key, so that a retry of the
same step sends the same key.
import { OneSayClient } from "@onesay/sdk";
// A short-lived Human token from your own sign-in; never an API key.
const client = new OneSayClient({ environment: "production", tokenProvider: async () => humanToken });
// Step 3: connect with your app session and microphone Source.
const session = await client.rtc.connect({ roomId, appSessionId, microphoneSourceId: sourceId, idempotencyKey: connectKey });
// Step 4: capture and publish your microphone directly (no extra server call).
const microphone = await session.audio.publishLocalMicrophone();
// Step 7: sound starts from the person's own click (LiveKit autoSubscribe delivers everyone's audio).
soundButton.onclick = () => session.audio.enablePlayback();
// Step 8: leave (stop local capture, then disconnect).
await microphone.stop();
await session.close();environment: "production" uses the addresses the SDK's environment table (SDK_ENVIRONMENTS) names for it: https://api.onesay.com/v1 and wss://realtime.onesay.com/v1. To reach another regional node, call setCustomEndpoints with the addresses from your configuration and use environment: "custom".
The Room and the app session are created through the Control API
(createRoom, createAppSession), as in step 1 and step 2.
Listening at the join
In JavaScript SDK v0.2.0, the Consent for connecting (rtc.connection.create)
says that you hear the other members automatically after you join, and the
connection's access token lets LiveKit subscribe you to every member's audio, as
in a LiveKit conference.
session.capabilities.autoSubscribeistrueafterclient.rtc.connect.- There is no separate listening step, no server-side subscription call and no listening confirmation. Members who join later are heard as they publish.
- To mute or unmute one remote participant locally without a server request,
read opaque handles from
session.peers(orsession.onPeersChanged) and callsession.audio.setPeerSubscribed(peer, subscribed). To restrict which peers can subscribe to tracks you publish, callsession.audio.setTrackSubscriptionPermissions({ allowAll, allowedPeers }). - Hearing an Agent and sharing your microphone still need their own permission.
Consent
Every step that creates, changes or ends something asks the person for
confirmation first: creating the Room, starting the app session, connecting (with microphone_source_id),
closing the app session and closing the Room. Ending what is
your own (your publication, your connection) needs no confirmation. Your application asks OneSay for a
confirmation of that exact step (createConsentRequest), shows it, records the
person's own Allow or Deny (decideConsentRequest) and then runs the step with the
same input. Nothing is allowed by default, and reads such as the roster need no
confirmation. The Console's Voice room panel shows this pattern.
Current limits (preview)
- A fixed group. The creator picks three or four people. Everyone joins and speaks in the same Room.
- Someone leaving no longer ends the others' connections, but the group cannot change. Nobody can be added or removed in this preview. To talk again as a different group, leave and start a new Room.
- One at a time. Join one at a time: wait until the previous person appears in the participant list (
listRoomParticipants; in the Console, under Who is here) before you join; people who join or start listening at the same moment can fail to connect or stay unheard. If a step fails because the service is busy, try again with the same key. If you still cannot hear someone, leave and start a new Room. - At most four people in one Room.
- Voice only. Video, screen sharing, recording, moderation, guest links and dial-in are not part of this preview.