Repaired emit broadcaster

This commit is contained in:
clerie 2018-04-03 12:50:22 +02:00
parent 8ee0d9d122
commit d5d93a126a
1 changed files with 2 additions and 1 deletions

View File

@ -9,6 +9,7 @@ app.use(express.static(__dirname + '/public'));
function onConnection(socket){
socket.on('input', function(data) {
console.log(data);
var command = data.split(" ");
if (command.lenght() == 4) {
if (command[0] == "PX") {
@ -16,7 +17,7 @@ function onConnection(socket){
var y = parseInt(command[2]);
if (!isNaN(x) && !isNaN(y)) {
var color = command[3]
socket.broadcast.emit('draw', {type: 'pixel', x: x, y: y, color: color}}));
socket.broadcast.emit('draw', {type: 'pixel', x: x, y: y, color: color});
}
}
}