Created
June 19, 2013 09:31
-
-
Save oxsav/5813010 to your computer and use it in GitHub Desktop.
Test RTCMultiConnection-v1.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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