From 2ab632a582979401eac7e90078403dab7d34034e Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Tue, 29 Apr 2014 17:57:58 +0200 Subject: [PATCH] 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 --- public/js/vroom.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/public/js/vroom.js b/public/js/vroom.js index 114e299..ee2d2aa 100644 --- a/public/js/vroom.js +++ b/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 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);