title: Longpolling vs Websockets
body: <p>I start developing a software, app coded using html + js I need to send this app notification from the server (java code) the app using nginx for routiong and is hosted in AWS.
  I investigated this subject of real time notification and I get confused between web sockets to long polling
  <a href="https://stackoverflow.com/questions/10028770/html5-websocket-vs-long-polling-vs-ajax-vs-webrtc-vs-server-sent-events">In what situations would AJAX long/short polling be preferred over HTML5 WebSockets?</a></p>
  
  <p>In some articles I read that long polling is an old unlike websocket which is newer and better (<a href="https://stackoverflow.com/questions/10028770/html5-websocket-vs-long-polling-vs-ajax-vs-webrtc-vs-server-sent-events">In what situations would AJAX long/short polling be preferred over HTML5 WebSockets?</a> )
  I start inspect element of gmail facebook whatsapp web pages.
  I saw that Gmail+ facebook using long polling Unlike whatsapp which using Websocket.
  So why these companies still choose to use long polling?
  <a href="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" rel="nofollow noreferrer">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</a></p>