title: Angular2: http - actual long polling
body: <p>I have a 3rd party service to implement, that provides restful API with long polling... they are serving live events, and displaying it as quick as possible is crucial.</p>
  
  <p>Sadly that service does not provide push notifications, so we need to deal with what we have....</p>
  
  <p>so one of the APIs has a <strong>long-polling</strong> functionality, so in theory the idea is, I query the API, establish an open channel for 30 seconds and wait for the changes... (and publish the changes on the FE)... and then timeout the connection, establish a new one and repeat the process.</p>
  
  <p>Should be pretty straight forward.... </p>
  
  <p>But so far, I couldn't find anything in angular's docs about long polling... the only thing I found was polling in connection with rxJS... so setting an inteval on how often I query the API... (which in my case would be every 30s)... but nothing about on leaving the channel open and listen for the changes...</p>
  
  <p>found this thred:
  <a href="https://stackoverflow.com/questions/44392038/how-to-implement-http-long-polling-in-angular-2">How to implement http long polling in Angular 2</a></p>
  
  <p>but it is not talking about this problem.</p>
  
  <p>I don't want to end up querying the API every second.</p>
  
  <p>Any ideas?</p>
  
  <p>I considered implementing signalR (which might not really help here), but it relies on jQuery... which I don't want to add to the bundle unless is 100% necessary!</p>