adding a new relay, 'pan'

This commit is contained in:
Dooho Yi 2020-05-20 04:17:24 +09:00
parent 811d021b4c
commit 64ee2d598b

13
app.js
View file

@ -65,7 +65,7 @@ io.on('connection', function(socket) {
//entry log. //entry log.
console.log('someone connected.'); console.log('someone connected.');
//on 'sound' --> relay the message to everybody INCLUDING sender //on 'sound'
// var soundactive = false; // var soundactive = false;
socket.on('sound', function(sound) { socket.on('sound', function(sound) {
@ -78,6 +78,17 @@ io.on('connection', function(socket) {
console.log('sound.group :' + sound.group); 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 //on 'clap' --> relay the message to everybody INCLUDING sender
socket.on('clap', function(clap) { socket.on('clap', function(clap) {