1
0
mirror of https://github.com/dani/vroom.git synced 2024-06-02 05:21:39 +02:00

Unicast name and color

When a new peer joins, send him our name and color, but don't broadcast it, other peers should already have this
This commit is contained in:
Daniel Berteaud 2014-04-29 17:57:58 +02:00
parent 7412b2f4ef
commit 2ab632a582

View File

@ -157,10 +157,9 @@ function initVroom(room) {
// but wait a bit so channels are fully setup (or have more chances to be) before we send // but wait a bit so channels are fully setup (or have more chances to be) before we send
setTimeout(function(){ setTimeout(function(){
if ($('#displayName').val() !== '') { if ($('#displayName').val() !== '') {
// TODO: would be better to unicast that peer.sendDirectly('vroom','setDisplayName', $('#displayName').val());
webrtc.sendDirectlyToAll('vroom','setDisplayName', $('#displayName').val());
} }
webrtc.sendToAll('peer_color', {color: peers.local.color}); peer.send('peer_color', {color: peers.local.color});
}, 3500); }, 3500);
} }
$(div).attr('id', 'peer_' + id); $(div).attr('id', 'peer_' + id);