Why WebRTC is harder than it looks

WebRTC lets browsers exchange audio, video and data directly. The browser API fits on a page, so a video call looks like a weekend project. It rarely is. Before two users see each other reliably, you have to build or run all of this:

None of this is your product. It is plumbing that has to work before your product can start. Weei is that plumbing, already running, with tools on top.

What Weei gives you

Weei is a JavaScript library and a hosted service. Your page loads one script; participants on the same site and in the same room find each other and connect over WebRTC. Signalling, STUN and TURN, connection races, relaying and reconnection are handled by Weei. Your code works with participants, media streams and widgets.

1. Register your application

Sign in to the control panel, Weei-CP, with Google, GitHub or Facebook. New accounts are created on first sign-in.

Weei-CP sign-in page with Google, GitHub and Facebook buttons
Sign in to Weei-CP.

Open Sites and choose Add site. Enter a name and your site's address, with the port if it uses one. Weei works only on the origins you register, so add your local development address and your production address separately.

The New site form in Weei-CP with a name and a site URL
Add your site's origin. A new site starts with every widget enabled.

In the site's Widgets tab you choose which widgets the site may use and who can use each of them.

The Widgets tab of a site in Weei-CP, with a toggle and an access setting for each widget
Turn widgets on or off and choose who may use them.

2. Add Weei to your page

This is the whole integration, from the Get Started guide. Serve the page over HTTPS from the origin you registered.

HTML
<script type="module">
  const loaderUrl = 'https://weei-core.web.app/loader.min.js';

  window.weeiReady = (async () => {
    const { loadWeei } = await import(loaderUrl + '?t=' + Date.now());
    const weei = await loadWeei();
    weei.setVisibility(true);
    return weei;
  })();
</script>

Open the page in two browser tabs: both show Weei's control panel and see each other as participants. From there users can call each other, share the screen and open widgets. To show your own users' names, call setUser().

3. Use the widgets

Widgets are ready-made tools that run over the same connections. Enable the ones you need in Weei-CP; many also have an API for your code.

WidgetWhat it does
ChatMessages, files, voice and video messages.
Screen shareShare a screen or window with the participants.
Shared controlUse your site together: everyone can click, type and scroll on the same page.
Whiteboard and SketchDraw over your page or on a shared sheet.
Recording DemosRecord and replay walkthroughs, capture issues with your app's events.
Notes, Shared document preview, TranscriptionMeeting notes, reviewing a file together and live speech-to-text.
Voting, Planning poker, Retrospective board, Approval cardsPolls, estimates, retrospectives and decisions.
Reactions, Raise handEmoji reactions and a queue of raised hands.
AI assistantAn AI chat inside your page.
Distributed Neural TrainingTrain a model together in participants' browsers.
Connection diagnosticsPing, network map and connection logs.

The full list with APIs is in Built-in widgets. Opening one from your own button is a single call:

JavaScript
const weei = await window.weeiReady;
weei.widgetsApi.open('chat');

4. Need something specific? Build a widget

If no built-in widget fits, you do not have to fall back to raw WebRTC. A site widget is a class in your own code that sends messages to the other participants over Weei's connections and shows its UI in a Weei window. You write the feature; Weei delivers the messages.

JavaScript
const weei = await window.weeiReady;
await weei.addWidget(CounterWidget);   // your class: a connector and a UI

The Build a site widget tutorial builds a counter shared by everyone in the session, step by step.

5. Your interface, Weei underneath

Weei's interface is optional. Call setVisibility(false) and none of it is built: your page draws its own call screen and uses Weei's APIs for participants, rooms and media.

JavaScript
const weei = await window.weeiReady;
weei.setVisibility(false);   // no Weei UI on the page

await weei.media.setCamera(true);
await weei.media.setMicrophone(true);

weei.media.subscribe(({ local, remote }) => {
  document.querySelector('#me').srcObject = local.camera;
  // remote: each connected participant's MediaStream, by peer ID
});

See Peers, rooms and media for connecting participants, rooms and media streams.

Build it or embed it

Your own WebRTC stackWeei
Signalling and presenceA server you build, host and scaleHosted
STUN and TURNRun or buy, rotate credentialsIncluded
Connection races and reconnectionYour codeHandled
Rooms beyond a few peopleMedia server or relayingHandled
Chat, screen sharing, whiteboard, shared controlEach built from scratchWidgets, enabled in Weei-CP
Custom featuresYour code on top of your stackSite widgets on Weei's connections
Your own interfaceYesYes, with setVisibility(false)

Get started

Register your site in Weei-CP, follow Get Started, and open the page in two tabs. Questions about your case? Contact us.