Note: The points below are a comparison of using vanilla websockets on client and server and using 'em via socket.io and not about why only use socket.io
- Native websockets provide us with only a
send
method to send data to the server. Send accepts onlystring
input (not too sure about this). Socket.io lets us emit arbitrary events with arbitrary data (even binary blobs) to the server. - To receive messages on a vanilla websocket you can only assign a handler for the
message
event. The data you receive is mostly likely to be text (again not too sure about this) and you will have to parse it manually before consuming it. Socket.io lets the server and client both emit arbitrary events and handles all the parsing and packing/unpacking. - Socket.io gives us both a server and a client. Implementing a vanilla websocket server isn't something that you would want to do per project since it's quite painful. You will have to implement [RFC6455](https://tools.ietf.org/h