io.on('connection', function (socket) { socket.on('sendserver', function (packet) { if (packet.security.key === configuration.key) { packet.edge.timestamp = Date.now(); console.log(packet.edge); edge.pushIfNotExist(packet.edge, function (e) { return e.ip === packet.edge.ip; //check if the server already exists in the array! }); socket.emit('serverUpdated', {updated: 'OK'}); } else { socket.emit('serverUpdated', {updated: 'FAIL -> Security Key Invalid'}); } }); });