SimpleWebRTC

Introduction

SimpleWebRTC is an amazing WebRTC API built by our good friends at &yet. It is both powerful and versatile, and the best part is that it’s constantly updated by a team of amazing people. Not to mention, the signaling server is open source! An exemplary application of all its richest features can be found on Talky, an awesome group video chat solution by &yet.

Because WebRTC is such a new technology, solid WebRTC APIs are still few and far between these days. But SimpleWebRTC is one of the best we’ve seen, so much so that we’ve decided to persuade our clients to use it and focus on our strength: highly reliable TURN servers.

We have modified SimpleWebRTC’s basic demo to hook into our STUN and TURN servers, as well as our signalling, so this tutorial will walk you through setting up your own instance of this demo.

Don’t like SimpleWebRTC? You can hook any WebRTC API into our platform.

Prerequisites

If you haven’t already, we highly suggest that you first read our Quick start guide. This guide should give you a fundamental understanding of our platform, making hooking SimpleWebRTC into the Xirsys platform a piece of cake.

The Demo

SimpleWebRTC’s bare-bones demo can be found here. We’ve modified this demo for this tutorial. By default, it is configured to connect to Google’s STUN server at stun.l.google.com:19302, which is intended for public use. It does not connect to any TURN servers out of the box. That’s where we come in. So go ahead and download our XSDK repo and let’s get started.

Create Domain and Application

The first step is to login to your Xirsys dashboard and create a unique domain. You can then either create an application and room within that domain, or you can just use the ‘default’ application and room that is created for you (refer to our Quick Start Guide for further info on this step).

Add Your Credentials

Open the ‘xirsys_connect.js’ file within the “./examples” folder of the XSDK. This is going to contain all of your connection details, such as ident, secret key and room data

var xirsysConnect = {
  secureTokenRetrieval : false,
  data : {
    domain : 'my-domain.com',
    application : 'default',
    room : 'default',
    ident : 'my-ident',
    secret : 'my-secret',
    secure : 1
  }
};
You will need to enter your own information here, using the domain/application/room you just created, as well as your ident and secret key, both of which you can find on your Xirsys dashboard.

Run the Demo

Now, just simply run the demo using your favorite development server from the root of the XSDK repository.

The demo should now run. If you open two windows, you can create a room in one window and connect in the other. The demo is automatically set up to create a new room in the Xirsys dashboard when you enter a new room name in the room input field, if it does not already exist.

Confirmation

If you have set everything up right, you should be able to make and receive calls successfully. You can confirm you are actually connected to the Xirsys servers within your Xirsys dashboard by checking your STUN connections. You can also double check if you are connecting to our servers by opening chrome://webrtc-internals on another tab, then run your demo and check the output to see if you are connecting to something that looks like this turn://endpoint0x.uswest.xirsys.com URL as the STUN or TURN URL.

Though this is good enough to start developing a beautiful WebRTC app, please don’t forget to set up a proper, secure backend from which to call our ICE servers, failure to do this will result in unwanted users hijacking your TURN bandwidth and other security flaws.