socket.io client not receiving messages from server

The function passed to .on is called for each socket to do the initialization (binding events etc), and socket refers to that current socket. This will be client 1 when you receive a push message, because the handler function is bound to the push event of that socket – you bound that function when client 1 connected (where socket refers to client 1).

io.sockets refers to all sockets connected, so including client 2 in your case.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)