|
|
|
|
|
by mitchi
4082 days ago
|
|
Socket.io is wayyyyy more noob-friendly. If you send json over the wire, socket.io automatically converts it to a javascript object or array for you, ready to be used. The best feature however is that you can send emit any string as an event : socket.emit("hello"); and the server can listen on this event with socket.on("hello"). If you want to do the same thing with the reference WebSocket you have to re-implement the same thing again and you will probably end up recoding the wrapper that socket.io already gives you. |
|
That's literally 4 lines
> socket.emit("hello"); and the server can listen on this event with socket.on("hello").This is hardly any more lines of code
Sure I'm glossing over a few things but EventEmitter is 10-20 lines depending on how crazy you want to get and wrapping both in a objects is probably another 10-20 linessocket.io on the other hand is a C node.js plugin and 61000 lines of JS code :(