webrtc.io

Abstraction for webRTC.

RTC.io

An abstraction layer for webRTC. Aim is to simplify the HTML5 web standard webRTC in a similar manner to socket.io w/ websockets.

Client

<script src="/rtc.io/rtc.io.js"></script>
<script>
    server = rtc.sync(server, [video1]);
    rtc.onSync(console.log('Connected to server' );
    rtc.onConnect('initialize video screen for stream');
 
    
    rtc.sync(serverIP, [list of arbitrary types]);
    rtc.addPeers();
    rtc.addPeer(peer, success(), fail());
    rtc.onConnect( do stuff);
 
</script> 

Server

var rtc = require('rtc.io');
rtc.onSync(function( data){
    var peers = rtc.getConnectedPeers()
    for node in peers {
        if (node.page == 'chat'){
            rtc.connect(me,node);
        }
    }
});
 
rtc.sendPeer([list of peers]);
rtc.onSync();
rtc.getPeers();