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
1 changed files with 2 additions and 3 deletions

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
setTimeout(function(){
if ($('#displayName').val() !== '') {
// TODO: would be better to unicast that
webrtc.sendDirectlyToAll('vroom','setDisplayName', $('#displayName').val());
peer.sendDirectly('vroom','setDisplayName', $('#displayName').val());
}
webrtc.sendToAll('peer_color', {color: peers.local.color});
peer.send('peer_color', {color: peers.local.color});
}, 3500);
}
$(div).attr('id', 'peer_' + id);