Failed to execute socket emit event socket.io

I used npm to install socket.io. The server is working fine, but does not capture personalized outbound events from the client.

The documentation for socket.io is not updated, for example, the socket.io-node package does not exist in the npm registry, as the git page says.

So, I am wondering if this function is in the basic installation of socket.io or if I am doing something wrong.

My code basically looks like this:

Server:

client.on('checkin', function (name) { ... }); 

customer:

 socket.emit('checkin',name); 

Is there anything else I need to do?

+4
source share
2 answers

Socket.io 0.7 was released today (see this link ), and the events used by @penguinbroker in this code example now work.

+1
source

The repo documents were updated three days ago, changing the link from 'socket.io' to 'socket.io-node', so it looks like everything is happening in the stream.

To get the necessary functionality, you can check eventedsocket at https://github.com/torgeir/eventedsocket (npm install eventedsocket)

From README.md:

Eventedsocket adds an event similar to a behavior to your socket.io connection, allowing you to send events from clients (clients) to the server or server to the client (s). Your user events along with the desired data are transmitted as json via any socket.io protocol that you can select.

+1
source

All Articles