exemplo simples de socket com node
Here is what the above code is Doing:
1. We’re importing the socket.io library.
2. We’re creating a socket.io client.
3. We’re listening for the ‘message’ event.
4. We’re logging the message to the console.
5. We’re displaying the message in the browser.
Now, let’s create a server that will send a message to the client.