It is strongly suggested to try RTCMultiConnection instead.
=
Use RTCDataConnection to share files, data, or text
Write your own group file sharing application in maximum 2 minutes!!
<script src="https://bit.ly/RTCDataConnection-v1-0"></script>
var rtcDataConnection = new RTCDataConnection({
onmessage: function (data) {
console.log(data);
},
openSignalingChannel: function (config) {
var socket = io.connect('http://your-site:8888');
socket.channel = config.channel || 'WebRTC-RTCDataConnection';
socket.on('message', config.onmessage);
socket.send = function (data) {
socket.emit('message', data);
};
if (config.onopen) setTimeout(config.onopen, 1);
return socket;
},
// 'one-to-one' || 'one-to-many' || 'many-to-many'
// default: 'many-to-many' ------- it is optional
direction: 'one-to-many'
});
// Only session initiator should call below line;
// All other 10000 room participants don't need to call "initDataConnection"!
rtcDataConnection.initDataConnection();
// to send file/data /or text
rtcDataConnection.send( file || data || 'text' );
=
- Share files of any size — directly
- Share text messages of any length
- Share any kind of data — directly
=
=
RTCDataConnection works fine on following web-browsers:
Browser | Support |
---|---|
Firefox | Stable / Aurora / Nightly |
Google Chrome | Stable / Canary / Beta / Dev |
=
RTCDataConnection is released under MIT licence . Copyright (c) 2013 Muaz Khan.