Establishing WebRTC Connections

Will Holcomb

28 June 2013

WebRTC is an extension to cutting-edge browsers that allows for P2P connections. A popular example is Google's AppRTC which sets up a chat between two browser windows. Another interesting example is Sharefest which allows drag and drop file sharing.

To run this example, you will need:

Even though the connections for these programs are between two browser windows, connection setup requires accessing servers at known locations on the internet. This intermediating server is known as a signaling server. It communicates SDP and ICE messages back and forth to establish peer connections.

The application for this example is a wall. Open this page in multiple tabs and you can send messages between them as well as anyone else in the world who has a page open and is using the same signaling server.

    The biggest outstanding issue with the example is onclose and onerror aren't getting called so peers never show as disconnected.

    AppRTC uses the Google Channel API for signaling. For the purposes of this example, we will be using ShareIt's SimpleSignaling which routes messages between websockets running on Node.js.

    Unfortunately, Heroku doesn't support websockets. So, we will use an ec2 instance :

    To use SimpleSignaling, include simpleSignaling.js in your HTML.