Longpolling vs Websockets

I'm starting to develop software, the application is encoded using html + js. I need to send this application from the server (java code) using nginx for routiong and is hosted in AWS. I have researched this subject of real-time notification, and I am embarrassed between web sockets for a lengthy survey. In what situations is it preferable to use a long / short AJAX poll over HTML5 web sockets?

In some articles, I read that long polling is an old websocket-like one that is newer and better ( In which situations is it preferable to use a long / short AJAX polling over HTML5 Web sites? ) I am starting to check the gmail facebook page element whatsapp . I saw that Gmail + facebook uses a lengthy poll. Unlike whatsapp, which uses a Websocket. So why do these companies still prefer to use long polls? https://www.quora.com/Does-Facebook-use-WebSockets-for-any-of-their-applications-Are-they-really-useful-at-that-scale-especially-since-they-impose- a-stateful-architecture

+5
source share
2 answers

A few reasons why some companies still use a lengthy survey:

  • WebSocket support is still not 100%, although legacy browsers without support are slowly dying out. Therefore, if you are a company like Google, where the products should work in almost all browsers, you still need to have a backup solution other than WebSocket.
  • If you already have a working solution, then the cost of moving to WebSocket can significantly outweigh the savings that it brings.
+3
source

WebSockets is better, it just drains less energy, the client does not have to request content every X times, the only drop that older browsers do not support.

You have a full comparison on this other question if you want more information.

In what situations is it preferable to use AJAX long / short polling over HTML5 Web sockets?

-1
source

Source: https://habr.com/ru/post/1246005/


All Articles