MENU

room IDs

Introduction

Room IDs are how your application's users create peer connections with each other.

It's pretty simple: Peers get into the same room if they pass the same roomId into the Vega Prime constructor. Take, for example, Bob's Vega Prime instance.

// Bob's Vega Prime instance

new VegaPrime({
  url: 'wss://my-secure-vega-server.com',
  roomId: 'abc123',
  badge: {}
});

If Nancy wanted to create a peer connection with Bob, her browser's JavaScript must instantiate VegaPrime with a roomId of 'abc123'.

Patterns

Next, there are a few patterns that could help you think of how to get peers in the same room.

It's a party and everyone's invited!

If you want every user to talk to each other, just give everybody the same room id. A good example of this is over at the demo page.

Take Bob's Vega Prime instance, for example.

new VegaPrime({
  url: 'wss://my-secure-vega-server.com',
  roomId: 'abc123',
  badge: {}
});

That room id of abc123 is hardcoded. If every user hits a page with that script, everyone ends up in the room. Pretty simple.