WebSync is used as signaling gateway with/for WebRTC-Experiments e.g. RTCMultiConnection.js, DataChannel.js, Plugin-free screen sharing, and video conferencing. This repository is a sub part of https://github.com/muaz-khan/WebRTC-Experiment
JavaScript ASP C#
Latest commit 91fa6fe Jan 19, 2014 @muaz-khan WebSync is used as signaling gateway for https://www.webrtc-experimen…
…t.com/

This repository is a sub part of
https://github.com/muaz-khan/WebRTC-Experiment. You'll see how
websync/c#/ASP.NET can be used for webrtc signaling.

README.md

Realtime/Working WebRTC Experiments and WebSync! Demos

WebSync is used as signaling gateway for/with:

  1. RTCMultiConnection.js
  2. DataChanel.js
  3. Video-Conferencing experiment
  4. Plugin-free screen sharing experiment

and many others. Try a few demos: http://websync.somee.com/

Please visit main repository for other WebRTC experiments:

https://github.com/muaz-khan/WebRTC-Experiment

This repository contains two directories:

  1. Deployment-Package
  2. Source-Code

"Deployment-Package" directory can be deployed on any IIS +=7 web-server.

"Source-Code" is written in C# and ASP.NET WebForms.

How to use WebSync for signaling?

<script src="fm.js"> </script>
<script src="fm.websync.js"> </script>
<script src="fm.websync.subscribers.js"> </script>
<script src="fm.websync.chat.js"> </script>
// www.RTCMultiConnection.org/latest.js

var connection = new RTCMultiConnection();

// ------------------------------------------------------------------
// start-using WebSync for signaling
var channels = {};
var username = Math.round(Math.random() * 60535) + 5000;

var client = new fm.websync.client('websync.ashx');

client.setAutoDisconnect({
    synchronous: true
});

client.connect({
    onSuccess: function () {
        client.join({
            channel: '/chat',
            userId: username,
            userNickname: username,
            onReceive: function (event) {
                var message = JSON.parse(event.getData().text);
                if (channels[message.channel] && channels[message.channel].onmessage) {
                    channels[message.channel].onmessage(message.message);
                }
            }
        });
    }
});

connection.openSignalingChannel = function (config) {
    var channel = config.channel || this.channel;
    channels[channel] = config;

    if (config.onopen) setTimeout(config.onopen, 1000);
    return {
        send: function (message) {
            client.publish({
                channel: '/chat',
                data: {
                    username: username,
                    text: JSON.stringify({
                        message: message,
                        channel: channel
                    })
                }
            });
        }
    };
};
// end-using WebSync for signaling
// ------------------------------------------------------------------

// check existing sessions
connection.connect();

// open new session
document.getElementById('open-new-session').onclick = function() {
    connection.open();
};

Demos using WebSync for Signaling

  1. RTCMultiConnection All-in-One Demo
  2. DataChannel.js » A WebRTC Library for Data Sharing
  3. Video Conferencing
  4. Plugin-free Screen Sharing
  5. Admin/Guest audio/video calling using RTCMultiConnection
  6. WebRTC Group File Sharing using RTCDataChannel APIs!

Muaz Khan (muazkh@gmail.com) - @muazkh / @WebRTCWeb

This repository's main URL is:

https://github.com/muaz-khan/WebSync-Signaling

License

WebRTC Experiments are released under MIT licence . Copyright (c) 2013 Muaz Khan.