Skip to main content

What are Hot and Cold Observables and how do they differ?

Junior Angular
Quick Answer Cold observable: starts executing when subscribed, each subscriber gets their own execution (e.g., HttpClient - each subscribe makes a separate HTTP call). Hot observable: executing regardless of subscribers, all subscribers share the same execution (e.g., mouse events, WebSocket). Important distinction: subscribing to a cold HTTP Observable twice makes two HTTP requests. Use shareReplay() to make cold observables hot.

Answer

Cold Observables: Start producing values on subscription (e.g., HTTP calls).

Hot Observables: Produce values regardless of subscribers (e.g., events, websockets).

Cold = fresh execution per subscriber; Hot = shared execution.

S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice