I have this snippet on my client script:
socket.on('bla', function(data) {
if (data == ID) {
console.log('What the hell is happening?');
}
})
socket.on(ID, function(data) {
console.log('here:');
console.log(data);
console.log(ID);
});
And this snippet on my server script:
io.sockets.emit('bla', pairs[pairs.length-1][0].ID);
io.sockets.emit(pairs[pairs.length-1][0].ID, 'go');
This results in the client console outputting
What the hell is happening?
but not outputting anything else. Which means that pairs[pairs.length-1][0].ID
on the server does equal ID
on the client, but for some reason when I use them as a socket message name, it fails to match...