Skip to content

Instantly share code, notes, and snippets.

@oxsav
Created June 19, 2013 09:31
Show Gist options
  • Save oxsav/5813010 to your computer and use it in GitHub Desktop.
Save oxsav/5813010 to your computer and use it in GitHub Desktop.
Test RTCMultiConnection-v1.3
var SIGNALING_SERVER = ':8888/';
var extra = {
openSignalingChannel: function(config) {
console.log(config);
var channel = config.channel || this.channel || 'one-to-one-video-chat';
var sender = Math.round(Math.random() * 60535) + 5000;
io.connect(SIGNALING_SERVER, {secure: true}).emit('newchannel', {
channel: channel,
sender : sender
});
var socket = io.connect(SIGNALING_SERVER + channel, {secure: true});
socket.channel = channel;
console.log("SOCKET");
console.log(socket);
socket.on('connect', function () {
console.log("ligado");
if (config.callback) config.callback(socket);
});
socket.send = function (message) {
socket.emit('message', {
sender: sender,
data : message
});
};
socket.on('message', config.onmessage);
}
};
var connection = new RTCMultiConnection("session-id", extra);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment