From 64ee2d598bf51fa9517468e0ecbe0310b3f8fc87 Mon Sep 17 00:00:00 2001 From: Dooho Yi Date: Wed, 20 May 2020 04:17:24 +0900 Subject: [PATCH] adding a new relay, 'pan' --- app.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index 681458e..107bf08 100644 --- a/app.js +++ b/app.js @@ -65,7 +65,7 @@ io.on('connection', function(socket) { //entry log. console.log('someone connected.'); - //on 'sound' --> relay the message to everybody INCLUDING sender + //on 'sound' // var soundactive = false; socket.on('sound', function(sound) { @@ -78,6 +78,17 @@ io.on('connection', function(socket) { console.log('sound.group :' + sound.group); }); + //on 'pan' + socket.on('pan', function(pan) { + + //relay the message to everybody EXCEPT the sender + socket.broadcast.emit('pan', pan); + + //DEBUG + console.log('pan.width :' + pan.width); + console.log('pan.speed :' + pan.speed); + }); + //on 'clap' --> relay the message to everybody INCLUDING sender socket.on('clap', function(clap) {