Difference between cold or hot HTTP requests?

Can someone explain two things to me:

  • Difference between cold or hot HTTP requests?
  • Are there any HTTP requests in Angular 2 Cold or Hot?
+3
source share
2 answers

In Angular, HTTP requests made from the Http service are cold.

Cold in this context means that the HTTP request is not executed until someone joins the observable returned from Http.get, Http.post, etc. In addition, each HTTP-monitored subscription will cause another http request to be fired. This is because when observing a cold, the observed http is responsible for creating its producer (i.e. Ajax Request) when subscribing, and each subscription will create a separate value producer (i.e. Separate Ajax requests).

Thoughtram contains a detailed article on hot and cold observables.

+7
source

Cold, as any request is just starting to produce value when you subscribe to it. No start

http.get().subscribe((response) => ...)

No request will be sent to the server. http.get()only one object.

+5

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


All Articles