I'm getting the same error when using last version of socket.io-client on Node.js. If I use an older version like v2.3.0 I don't get any error.
Here is what the above code is Doing:
1. Create a new socket.io client instance.
2. Connect to the server.
3. Send a message to the server.
4. Listen for a message from the server.
5. Log the message to the console.