skip to content

In a mobile auction app, which live transport would you choose for the bidding room, the watch list, the outbid alert and the seller's dashboard?

level: middleimportance: must knowfreq 62%

answer

  1. freshness need, per feature
  2. is the app even running then?
  3. every radio wake-up has a cost
  4. a closed app hears only push
  5. a countdown needs an end time

basics

~20 s

Choose per feature: a held stream only while the bidding room is on screen, refresh-on-open or a slow poll for the watch list and seller's dashboard, and the platform push service for outbid alerts when the app is closed.

solid answer

~50 s

I'd ask three things of each feature: how stale it may be, whether the app is running when it matters, and which way the data flows. The open bidding room changes second by second in a lot's final minutes, so it gets a held connection - a one-way server stream, or a socket if it truly needs two-way traffic - opened when the room appears and closed when it goes. The watch list and the seller's dashboard tolerate a minute or more of staleness: fetch on open, refresh on pull and on return to the foreground, perhaps a slow poll while visible. The outbid alert matters most when the app is closed, and only the platform push service reaches a closed app. Every poll and every held connection wakes the radio, so nothing stays open that nobody is looking at.

go deeper

for a junior

Recall that each feature can use a different transport and that only push reaches a closed app. Be ready to say which of the four features gets which.

for a middle

Explain the three questions asked of every feature - staleness, app state, direction - and what each option costs in radio wake-ups, then defend each choice with them.

for a senior

Show the details that separate a design from a list: when each connection opens and closes, the watch list riding the room's stream, and no duplicate push for a room on screen.

for a principal

Turn it into an app-wide rule a team can apply to new features - who may hold a connection, at what freshness, and who may wake the user - so it is not re-argued screen by screen.

## Why the choice is per feature A **live transport** is how new data reaches the app without the user asking for it. A mobile client has five to choose from: - **Polling** - ask on a timer. - **Long polling** - ask, and the server holds the request until it has news or its hold ends. - **A one-way server stream** - one held HTTP response the server keeps writing events into, as **server-sent events** define. - **A two-way socket** - a **WebSocket** that both sides can write to at any time. - **Push** - a message sent through the **platform push service**, which reaches the phone even when the app is not running. Interviewers like an auction app for this because its features want different things. A candidate who picks one transport for the whole app - usually "WebSockets everywhere" - has skipped the design. ## Three questions to ask of each feature 1. **How stale may it be?** The price in a lot's final minute is stale after a second or two; a seller's sales total is fine a few minutes old. 2. **Is the app running when it matters?** A bidding room only matters while it is on screen. An outbid alert matters most when the bidder has put the phone away. 3. **Which way does data flow, and how often?** Prices flow from server to phone continuously; bids flow the other way occasionally. ## The four features | Feature | Staleness it tolerates | App state when it matters | Choice | Why | |---|---|---|---|---| | Open bidding room | about a second near the end | foreground, on this screen | one-way stream (or a socket), opened with the screen | many updates, only while watched | | Watch list | a minute or so | foreground | fetch on open, pull to refresh, slow poll while visible | few changes per lot; a held connection would mostly idle | | Outbid alert | tens of seconds to minutes | usually backgrounded or closed | visible notification via the platform push service | the only path to an app that is not running | | Seller's dashboard | several minutes | foreground | fetch on open and on refresh | totals change slowly; nobody watches them by the second | The staleness figures are this scenario's assumptions, agreed with the product owner, not standards. Two refinements are worth saying aloud. If the bidder is already in a room, the watched lots' prices can ride the **same** stream as extra subscriptions instead of a second mechanism. And when an outbid happens while the bidder is in that very room, the stream has usually shown the new price already, so the server can skip the push or the app can show it as an in-app banner instead of a second alert. ## The countdown needs no transport Every lot shows an ending countdown, and a naive design sends a tick every second. The server only needs to send the **end time** once, with the lot, and the device counts down against its own clock, corrected by the offset between the server's time and the phone's, measured from a response. What does need a transport is a **change** to the end time - for example when the house extends a lot because a late bid landed, a rule this scenario assumes - and that change is simply another event on the room's stream, and is re-read from the server whenever the screen opens. ## What each option costs the phone - **Polling** wakes the radio on every interval whether or not anything changed; the cost grows with the frequency, so it suits features where a slow interval is acceptable. - **Long polling** reaches near-real-time freshness but pays a full request and response per batch of events. - **A held stream or socket** costs little per event but keeps a connection whose keepalive traffic wakes the radio even when nothing happens, so it is worth holding only while someone is watching. - **Push** rides the platform push service's single connection, which every app on the phone shares, so the app adds no connection of its own - but delivery is best effort. The radio is one of a phone's largest power draws, and why each wake-up costs more than its bytes is a question about radio power states in its own right; for this choice it is enough to count the wake-ups each feature causes. ## What strong answers avoid - A socket opened at launch and held all session as the answer for every feature, alerts included, though it cannot reach a closed app. Sharing one connection among the screens that are live is a different, sound idea; holding it while none is open is not. - Treating push as a data feed: it is the wake-up for a closed app, and the app fetches the truth when it opens. - Polling every few seconds on screens nobody is watching closely. - Forgetting to say when each connection **closes**, not only when it opens.

  • The bidder is in the room when someone outbids them. Should a push notification also arrive?
    Usually not as a system alert. The server can skip the push for devices it knows are subscribed to that room, or the app, told that a notification arrived while it is open, can show an in-app banner instead. Sending both buzzes the phone about something already on screen. The stream's price change is the primary signal while the room is open; push is for when it is not.
  • How would you set the watch list's polling interval?
    From the freshness the product needs and the cost of each wake-up: if a watched price may be a minute old, poll no faster than that, only while the screen is visible, and refresh immediately on open and on pull. Add jitter so a million phones do not poll in lockstep. When a watched lot enters its final minutes, link the bidder to its room rather than polling the list faster.

  • A WebSocket held from app launch can serve every feature, alerts included.
  • A socket can deliver the outbid alert while the app is closed.
  • The countdown needs a tick from the server every second.
  • Polling always costs the phone more than a held connection.
  • Push notifications can carry the live price feed.