commit b66340e1dddd470d35eb2b7dd7a4b3ba0aa9e889 parent 3b7298a3307889ee58c58336991ad2d308d77100 Author: Robin Linus <robin_woll@capira.de> Date: Mon, 28 Dec 2015 23:02:29 +0100 Notify clients only once of empty buddy-list Diffstat:
M | server/ws-server.js | | | 10 | +++++++++- |
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/server/ws-server.js b/server/ws-server.js @@ -126,7 +126,15 @@ exports.create = function(server) { isSystemEvent: true, type: 'buddies' }; - client.socket.send(msg); + if (buddies.length) { + client.socket.send(msg); + client.notifiedEmpty = false; + return; + } + if (!client.notifiedEmpty) { + client.notifiedEmpty = true; + client.socket.send(msg); + } }); }); }