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
This commit is contained in:
Florent Chehab 2020-05-02 12:51:17 +02:00
parent e2ddcbf162
commit 6f68f9f21f
No known key found for this signature in database
GPG Key ID: 9A0CE018889EA246
1 changed files with 2 additions and 2 deletions

View File

@ -202,14 +202,14 @@ function startBackendServer(port) {
if (smallestScreenResolutions && smallestScreenResolutions[whiteboardId] && socket && socket.id) { if (smallestScreenResolutions && smallestScreenResolutions[whiteboardId] && socket && socket.id) {
delete smallestScreenResolutions[whiteboardId][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(); sendSmallestScreenResolution();
}); });
socket.on('drawToWhiteboard', function (content) { socket.on('drawToWhiteboard', function (content) {
content = escapeAllContentStrings(content); content = escapeAllContentStrings(content);
if (accessToken === "" || accessToken == content["at"]) { 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 s_whiteboard.handleEventsAndData(content); //save whiteboardchanges on the server
} else { } else {
socket.emit('wrongAccessToken', true); socket.emit('wrongAccessToken', true);