Skip to content

Latest commit

 

History

History
 
 

RTCDataConnection

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' );

=

Features

  1. Share files of any size — directly
  2. Share text messages of any length
  3. Share any kind of data — directly

=

=

Browser Support

RTCDataConnection works fine on following web-browsers:

Browser Support
Firefox Stable / Aurora / Nightly
Google Chrome Stable / Canary / Beta / Dev

=

License

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