From 6f68f9f21f76abc5a143b71e9114020fbccd138f Mon Sep 17 00:00:00 2001 From: Florent Chehab Date: Sat, 2 May 2020 12:51:17 +0200 Subject: [PATCH] feat(backend): no compression & volatile * Should enable for more performances when there are a lot of users * Messages are pretty small so compression might not be needed * Volatile reduces the number of exchanges between the server and the clients --- scripts/server-backend.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/server-backend.js b/scripts/server-backend.js index 6250068..ce2ad14 100644 --- a/scripts/server-backend.js +++ b/scripts/server-backend.js @@ -202,14 +202,14 @@ function startBackendServer(port) { if (smallestScreenResolutions && smallestScreenResolutions[whiteboardId] && socket && socket.id) { delete smallestScreenResolutions[whiteboardId][socket.id]; } - socket.broadcast.emit('refreshUserBadges', null); //Removes old user Badges + socket.compress(false).volatile.broadcast.emit('refreshUserBadges', null); //Removes old user Badges sendSmallestScreenResolution(); }); socket.on('drawToWhiteboard', function (content) { content = escapeAllContentStrings(content); if (accessToken === "" || accessToken == content["at"]) { - socket.broadcast.to(whiteboardId).emit('drawToWhiteboard', content); //Send to all users in the room (not own socket) + socket.compress(false).volatile.broadcast.to(whiteboardId).emit('drawToWhiteboard', content); //Send to all users in the room (not own socket) s_whiteboard.handleEventsAndData(content); //save whiteboardchanges on the server } else { socket.emit('wrongAccessToken', true);