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
master
Daniel Berteaud 11 years ago
parent 7412b2f4ef
commit 2ab632a582
  1. 5
      public/js/vroom.js

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

Loading…
Cancel
Save