From a3c43b152c62399236c1ff6c621fdf23d801930b Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Wed, 21 Feb 2018 10:17:14 +0530 Subject: [PATCH] Server-side logging --- server.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server.js b/server.js index a6c7839..8c4aaed 100644 --- a/server.js +++ b/server.js @@ -41,6 +41,7 @@ io.on('connection', function (socket) { // a user has visited our page - add them to the visitorsData object socket.on('visitor-data', function (data) { visitorsData[socket.id] = data; + console.log('New Visitor', visitorsData[socket.id]); // compute and send visitor data to the dashboard when a new user visits our page io.emit('updated-stats', computeStats()); @@ -48,6 +49,7 @@ io.on('connection', function (socket) { socket.on('disconnect', function () { // a user has left our page - remove them from the visitorsData object + console.log('Visitor has left the site', socket.id); delete visitorsData[socket.id]; // compute and send visitor data to the dashboard when a user leaves our page