abf3545 Oct 22, 2016
1 contributor

Users who have contributed to this file

executable file 123 lines (81 sloc) 3.65 KB

Getting Started guide for RTCMultiConnection

This document explains how to getting-started with RTCMultiConnection.

Copy any HTML demo file

Copy any demo source from this page:

Now search for file. You will find this:

<script src="/"></script>

Replace above line with this one:

<script src=""></script>

Last step is: search for connection.socketURL. You will find these two lines:

connection.socketURL = '/';
// connection.socketURL = '';

Second line is commented. Simply remove // from the beginning of second line. Or in simple words: Uncomment second line:

connection.socketURL = '';

Now you are DONE. Congrats!!

Now try your HTML source on any HTTPs page. Remember HTTPs is required.

You can use for testing purpose.

Getting Started from Scratch

First of all, add these two lines:

<script src=""></script>
<script src=""></script>

Now add two buttons:

<button id="btn-open-room">Open Room</button>
<button id="btn-join-room">Join Room</button><hr>

Now add this javascript (somewhere on bottom of your page):

var connection = new RTCMultiConnection();

// this line is VERY_important
connection.socketURL = '';

// all below lines are optional; however recommended.

connection.session = {
    audio: true,
    video: true

connection.sdpConstraints.mandatory = {
    OfferToReceiveAudio: true,
    OfferToReceiveVideo: true

connection.onstream = function(event) {
    document.body.appendChild( event.mediaElement );

Last step is, add click-handlers for above two buttons:

var predefinedRoomId = 'YOUR_Name';

document.getElementById('btn-open-room').onclick = function() {
    this.disabled = true; predefinedRoomId );

document.getElementById('btn-join-room').onclick = function() {
    this.disabled = true;
    connection.join( predefinedRoomId );

Now you are DONE. Congrats!!

Now try above codes on any HTTPs page. Remember HTTPs is required.

You can use for testing purpose.

Other Documents

  1. Getting Started guide for RTCMultiConnection
  2. Installation Guide
  3. How to Use?
  4. API Reference
  5. Upgrade from v2 to v3
  6. How to write iOS/Android applications?
  7. Tips & Tricks



RTCMultiConnection is released under MIT licence . Copyright (c) Muaz Khan.