these days almost all browsers support websockets
why socket.io
is better?
why all popular websites use socket.io
?
where websockets
do not work and socket.io
works ?
Their are a lot of reasons but for starters socket.io automatically handles a backup plan if the users browser doesn't support websockets (long polling) and overall the API to use socket.io is much easier to understand and work with than regular websockets.
Eleven items that socket.io has that webSockets do not is described here: https://stackoverflow.com/questions/38546496/moving-from-socket-io-to-raw-websockets/38546537#38546537. Among them: detection of dead connection, auto-reconnect, rooms, middleware architecture, fallback for older browers, message based data format, etc...
Most helpful comment
Their are a lot of reasons but for starters socket.io automatically handles a backup plan if the users browser doesn't support websockets (long polling) and overall the API to use socket.io is much easier to understand and work with than regular websockets.