var socket = io(); /*Initializing the connection with the server via websockets */ socket.emit('liveMessage', "true"); socket.on("jsonHoneycomb",function(message){ /* When server sends data to the client it will trigger "message" event on the client side , by using socket.on("message") , one cna listen for the ,message event and associate a callback to be executed . The Callback function gets the dat sent from the server */ console.log("Message from the server arrived") prePopulate(message); socket.emit('ackMessage', "true"); });