Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why should I use Socket.io? [closed]

I am learning Node.js and am currently studying WebSockets. As I understand it, Socket.io was intended to address inconsistent support that the various browsers had with WebSockets...If you check out caniuse WebSockets, it appears that WebSockets currently has practically full support. Can anyone explain why I should use Socket.io versus WebSockets in this case?

like image 263
Danny Bullis Avatar asked Mar 03 '13 01:03

Danny Bullis


1 Answers

  1. It handles graceful degradation for you to numerous technical alternatives to get bi-directional near-time communication flowing (web sockets, ajax long polling, flash, etc)
  2. As of March 2013 that site lists web sockets at 61% support. This is not "practically full".
  3. As of September 2021 that site lists web sockets at 98% support. All modern browser's support Websockets.
  4. It handles browser inconsistencies and varying support levels for you
  5. (these first 2 things are basically the same value created by jQuery, to put it in perspective)
  6. It includes additional features beyond bare bones web sockets such as room support for basic publish/subscribe infrastructure and things like automatic reconnect
  7. AFAIK it is more popular and easier to get help with than vanilla web sockets, at least at the moment.

However, just like there is VanillaJS for the jQuery haters, if you prefer using the official standard web socket APIs directly, by all means, knock yourself out.

like image 106
Peter Lyons Avatar answered Nov 15 '22 20:11

Peter Lyons