muaz-khan / WebRTC-Scalable-Broadcast

This module simply initializes socket.io and configures it in a way that single broadcast can be relayed over unlimited users without any bandwidth/CPU usage issues. Everything happens peer-to-peer!
https://rtcmulticonnection.herokuapp.com/demos/Scalable-Broadcast.html
532 stars 142 forks source link

How can I use for textchat ? #14

Open mynameismaxz opened 8 years ago

mynameismaxz commented 8 years ago

I want to use scalable broadcast with text. How can I do it ?

muaz-khan commented 8 years ago

You can modify following demo for connection.send and connection.onmessage:

E.g.

connection.onmessage = function(event) {
    var senderId = event.userid;
    connection.getAllPartcipants().forEach(function(p) {
        if (p == senderId) return;
        connection.send(event.data, p);
    });
};