RTC rooms and Web SDK
Integration flow
Section titled “Integration flow”- Create a project and scoped key in the RTC console.
- Your backend creates a room using the server API.
- Your application authenticates a user and checks their room membership.
- Your backend requests participant credentials for that authorized room.
- The client joins with those credentials and publishes media if permitted.
- Your backend ends the room when the session is over.
Your end users do not receive the project API key. You remain responsible for the application’s identity, membership, consent, and user interface.
Create a room from your backend
Section titled “Create a room from your backend”# Replace the sample UUID with the project ID copied from your console.curl --fail-with-body \ --request POST https://api.rtc.champrep.com/v1/rooms \ --header "Authorization: Bearer $RTC_API_KEY" \ --header 'Content-Type: application/json' \ --data '{"projectId":"00000000-0000-4000-8000-000000000001","name":"Product support","maxParticipants":4}'Save the returned id in your application’s room record. maxParticipants
must fit both the current API constraint and the active plan allowance.
Do not automatically repeat room creation after an ambiguous timeout: the
first request might have succeeded. Check the list first.
Obtain participant credentials
Section titled “Obtain participant credentials”After checking your user’s access, your backend sends:
curl --fail-with-body \ --request POST "https://api.rtc.champrep.com/v1/rooms/$RTC_ROOM_ID/tokens" \ --header "Authorization: Bearer $RTC_API_KEY" \ --header 'Content-Type: application/json' \ --data '{"canPublish":true}'The response contains token, participantId, expiresIn, url, and
iceServers. Pass that credential set to the authorized client through your
own authenticated endpoint with caching disabled. Treat all of it as
sensitive. Credentials expire after five minutes for joining and cannot be
reused after a successful join. This is not a five-minute maximum call length.
Browser SDK
Section titled “Browser SDK”Use the supported JavaScript/TypeScript Web SDK distribution.
Contact CHAMPREP for package access and
installation instructions. Do not install a similarly named third-party package.
The following example assumes you already have the supplied RtcSession
class in your application. Its import path depends on that distribution.
const session = new RtcSession();
session.addEventListener('state', (event) => { updateConnectionLabel((event as CustomEvent).detail);});session.addEventListener('track', (event) => { const { id, stream, kind } = (event as CustomEvent).detail; attachRemoteMedia(id, stream, kind);});session.addEventListener('trackremoved', (event) => { removeRemoteMedia((event as CustomEvent).detail);});session.addEventListener('localtrack', (event) => { showLocalPreview((event as CustomEvent).detail);});session.addEventListener('error', (event) => { showCallError((event as CustomEvent).detail);});
await session.connect(async () => { // Your server authenticates this session and authorizes its room membership. // Implement CSRF protection appropriate to your application's session model. const response = await fetch('/your-app/rtc/join', { method: 'POST', credentials: 'same-origin', cache: 'no-store', }); if (!response.ok) throw new Error('Unable to join this room'); return response.json();});
// Call from your application's explicit microphone/camera consent flow.await session.publish(true);
// Call when leaving or unmounting the call screen.// session.close();The functions for rendering media and errors are application-specific
placeholders. Attach each returned stream to the appropriate audio or video
element, mute your local preview, set playsInline for video, and handle
autoplay rejection with a user-activated Play control. A remote audio track
needs an audio-capable element even when there is no video.
SDK controls
Section titled “SDK controls”| Method | Behavior |
|---|---|
connect(tokenProvider) | Join using a function that returns fresh credentials |
publish(true) | Request microphone and camera and publish their tracks |
publish(false) | Publish microphone audio without camera video |
setMuted(true) / setMuted(false) | Mute or unmute the microphone producer |
setCamera(false) / setCamera(true) | Disable or enable the camera producer |
shareScreen() | Open the browser chooser and publish a video-only screen track |
setReceiveQuality('low') | Request lower-quality received video |
setReceiveQuality('auto') | Restore normal received-video preferences |
close() | Leave, close transports, and release captured tracks |
Do not call publish for a receive-only participant. Prevent duplicate publish
actions in your UI. Screen audio is not captured by this API. To stop
sharing, use the browser’s Stop sharing control. Muting is not the same as
leaving; call close() to release the session and its captured devices.
Network changes and lifecycle
Section titled “Network changes and lifecycle”The SDK attempts reconnection after signaling interruptions and uses the token-provider function again. Always issue a new token after checking access; never cache a consumed token. Reconnection is bounded and may fail. Show connection and error states, and offer a user-controlled rejoin flow.
Low-bandwidth mode lowers received video quality; it cannot guarantee a call
on an unusable connection. Consider audio-only publishing when appropriate.
The SDK also accepts new RtcSession({ iceTransportPolicy: 'relay' }) for
relay-only connections, which require a reachable relay service.
Test real devices, browser permissions, restricted networks, backgrounding, screen sharing, and reconnect behavior before release. Python and Node.js SDKs and MEAN/MERN/MEN guides remain roadmap items.