From 49b924b79d44d0c85b8dae8db160e66cf4ea7ae8 Mon Sep 17 00:00:00 2001 From: rofl256 Date: Fri, 9 Feb 2018 02:22:01 +0100 Subject: [PATCH] dont send draw data back to yourself --- server.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index 1256532..e17f809 100644 --- a/server.js +++ b/server.js @@ -80,7 +80,7 @@ io.on('connection', function(socket){ socket.on('drawToWhiteboard', function(content) { content = escapeAllContentStrings(content); - sendToAllUsersOfWhiteboard(content["wid"], content) + sendToAllUsersOfWhiteboard(content["wid"], socket.id, content) s_whiteboard.handleEventsAndData(content); //save whiteboardchanges on the server }); @@ -92,9 +92,9 @@ io.on('connection', function(socket){ }); }); -function sendToAllUsersOfWhiteboard(wid, content) { +function sendToAllUsersOfWhiteboard(wid, ownSocketId, content) { for(var i in allUsers) { - if(allUsers[i]["wid"]==wid) { + if(allUsers[i]["wid"]===wid && allUsers[i]["socket"].id !== ownSocketId) { allUsers[i]["socket"].emit('drawToWhiteboard', content); } }