All jobs / Full-stack developer / End-to-End Architecture
Full-stack developer interview question · 1–3 years
The server needs to push status updates to the browser, and the client never sends anything back on that channel.
Server-sent events or a WebSocket?
The strongest answer
Server-sent events — it is ordinary HTTP one way, so existing auth and proxies work and the browser reconnects and resumes on its own; take a WebSocket when you genuinely need both directions at low latency
Why it works
Right — one-way push over plain HTTP costs far less to operate, and the built-in reconnect with a last-event id is a class of code you never write.
What a good answer covers
- One-way push: server-sent events.
- Plain HTTP, existing auth and proxies.
- Reconnect and resume are built in.
- WebSocket when both directions matter.
Answers that fall short
- Close, but not the strongest: A WebSocket — it is the standard for real-time, and we may want to send messages back later
Defensible, and you take on the upgrade, auth at the upgrade, proxy configuration and your own reconnection for a channel you use in one direction. - Weak: Server-sent events, and we send the client’s messages back up the same event stream when we need to
The event stream only flows from server to client; anything the client sends goes over a normal request. - Red flag: A WebSocket, with the access token in the query string, because the browser cannot set headers on it
URLs end up in proxy logs, browser history and referrers; use a cookie or a short-lived ticket exchanged at the upgrade.
Who gets asked this
More End-to-End Architecture questions
- You deploy API and UI. Support still sees errors from a field you renamed. What do you assume after a deploy?
- You need to change `amount` from a string to a number. How do you version without stranding the UI?
- You want to rename `title` to `headline` on a resource the SPA already ships. How do you roll the rename?
- What do you say, and when should the prompt appear?
- Every click on a table of 40 rows fires OPTIONS then GET, and it shows on slow networks. How do you stop the…
- You are tired of the form accepting a payload the API 400s. Where does the schema live?
- The marketing layout SSR-renders a 'Your workspace' header for logged-in people. How does the server render a…
- Creators upload long videos from phones on bad networks. How do you take a 2GB file on a train Wi-Fi?