Skip to content Skip to sidebar Skip to footer

How To Implement Http Long Polling In Angular 2

I have a use case as follows: User selects a video to be uploaded to their profile. Angular sends a request to node.js server which returns an Amazon S3 pre-signed URL. Browser 'd

Solution 1:

This is what I ended up doing:

public startLp(): Observable<any> {
let that = this;
let doLp = function(): Observable<any> {
  return that.http
    .get("/getvideostatus?video-id=blah", { headers: that.headers })
    .map(res => {
      return res.json().data
    })
    .catch((error: any) => {                    
      return doLp();
    });
};

return doLp();
}

Post a Comment for "How To Implement Http Long Polling In Angular 2"