These are chat archives for andyet/SimpleWebRTC

Apr 2017
Seyedamirhossein Hesamian
Apr 26 2017 02:06
var webrtc = new SimpleWebRTC({});

webrtc.on("connectionReady", function() {

webrtc.on("chat-amir734jj", function(sender, channel, data) {
    $("#chat").html($("#chat").html() + "<br>" + sender + channel + data);

$("#send").click(function() {
    webrtc.sendToAll("chat-amir734jj", "message", {
        text: $("#message").val()
I wrote this simple code but it simply does not work. webrtc.on("chat-amir734jj" never gets called
Any help would be appreciated.
Apr 26 2017 06:57

@StudioInteractive I can't seem to get it to work, is there no way to do it with SimpleWebRTC library? Like:

webrtc.on('videoAdded', function (video, peer) {
    console.log('videoAdded', peer.nick);

It's pretty straight forward here but this 'videoAdded' event doesn't seem to push to other peers unless they reload the page.

Apr 26 2017 08:57
@notasgoodasyou you could try to reconnect to the room after the video added. But you have to Renegotiation somehow with other peers. That they know that your peer have a new video or audio stream.
Apr 26 2017 09:05
@amir734jj all messages that are send over sendDirectly or sendToAll are recieved from this method : on('channelMessage', function (peer, label, data)
Saeid Saati
Apr 26 2017 12:38
@amir734jj hi, first of all it's better to prepare your constructor ! then the problem in your code is there is no event with name "chat-amir734jj" ! if you see list of supported eventes here :
so you can use 'videoAdded' event and then as @StudioInteractive said use methods like sendDirectly or sendToAll