Real Time Updates medium
How does HTTP/2 Server Push differ from Server-Sent Events (SSE)?
- A They are the same thing.
- B Server Push sends app data to JavaScript; SSE sends files to the browser cache.
- C Server Push is for pre-loading resources (CSS/JS) into the browser cache before they are requested; SSE is for pushing real-time application data to the JS code.
- D Server Push works over UDP.
Answer: C. Server Push is for pre-loading resources (CSS/JS) into the browser cache before they are requested; SSE is for pushing real-time application data to the JS code.
H2 Push is an optimization: 'You asked for index.html, take style.css too because I know you'll need it'. SSE is an application channel: 'Here is the new stock price'.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- When a mobile app is closed/backgrounded, it cannot keep a WebSocket open. How does it receive real-time alerts (like 'New Message')?
- For a human user, what is generally considered the maximum acceptable latency for an interaction to feel 'Real-Time' (e.g., typing in a Google Doc)?
- If you want to update a news feed on a website every time a new article is published, what is the simplest (but least efficient) 'Real-Time' technique?
- In a persistent real-time connection, what is the purpose of a 'Heartbeat' or 'Ping/Pong' message?
- Why is Short Polling considered 'Chatty'?
- Server-Sent Events (SSE) are ideal for which type of real-time application?