Lib-jitsi-meet with custom UI room setup issue?

I’ve created a custom UI built around the lib-jitsi-meet low-level API. I feel like this is a new issue (or, at least I never noticed any instability until now), but I’ve recently noticed that when two people join a room, they’ll often fail to connect. In my estimation, the participants will fail to connect about 50% of the time.

When logging all conference events in console, the main thing I notice when connections work and the two people join in the conference together is that the CONFERENCE_UNIQUE_ID_SET values match. When they fail to connect, the CONFERENCE_UNIQUE_ID_SET values mismatch.

My config is pretty basic:

{
  hosts: {
    domain: 'meet.jit.si',
    muc: 'conference.meet.jit.si',
    focus: 'focus.meet.jit.si'
  },
  bosh: 'https://meet.jit.si/http-bind',
  websocket: 'wss://meet.jit.si/xmpp-websocket',
  externalConnectUrl: '//meet.jit.si/http-pre-bind',
  enableP2P: true,
  useStunTurn: true,
  p2p: {
    enabled: true,
    enableUnifiedOnChrome: false,
    preferredCodec: 'VP9',
    disableH264: true,
    useStunTurn: true,
    stunServers: [
      { urls: 'stun:meet-jit-si-turnrelay.jitsi.net:443' }
    ],
  },
  serviceUrl: 'wss://meet.jit.si/xmpp-websocket',
  websocketKeepAliveUrl: 'https://meet.jit.si/_unlock',
  rttMonitor: {
    enabled: true,
    initialDelay: 1
  }
}

My code to connect looks something like this:

const connection = new JitsiMeetJS.JitsiConnection(null, null, config);
connection.addEventListener(JitsiConnectionEvent.CONNECTION_ESTABLISHED, onConnectionSuccessHandler);
connection.addEventListener(JitsiConnectionEvent.CONNECTION_FAILED, onConnectionFailedHandler);
connection.addEventListener(JitsiConnectionEvent.CONNECTION_DISCONNECTED, onConnectionDisconnectedHandler);

Once the CONNECTION_ESTABLISHED event is called, I create my local tracks and setup the conference:

const room = connection.initJitsiConference(roomName, config);
room.addTrack(localAudio);
room.addTrack(localVideo);
// setup listeners
room.join();

Here’s an example console log for the two participants side-by-side where it fails:

The "Joined conference: " entry will show the randomly generated room name - which is the same value between the two (which is used in the roomName value in the above code). Then you’ll see the CONFERENCE_UNIQUE_ID_SET come back with different IDs and no connection seems to be made.

When things do connect, the CONFERENCE_UNIQUE_ID_SET value looks to match for both participants.

Any thoughts why the two participants sometimes fail to connect? It almost seems like the request to create/join a room is hitting different servers (ie, perhaps a load balancer issue??).

First, you should not be using meet.jit.si like that because this breaks the terms and conditions Terms & Conditions | meet.jit.si Terms of Service.
You should consider hosting it yourself or using jaas.

You are hitting the specifics of the deployment of meet.jit.si as you are not passing room parameter to bosh and websocket URLs and your connection end up on different shards.

Got it! We’ll take a look into adding the room params.

Regarding self-hosting, sorry! This isn’t a commercial product, we were doing a POC to determine whether to move forward with Jitsi or not (and validating how difficult it’d be to build a custom UI for it). We are working on a self-hosted version right now, but were testing things on the main jisti service to validate our usage of lib-jitsi-meet.

Thanks for the insight!

:+1: