skip to content

Should a mobile auction app hold one live connection per feature, or share one across the bidding room, watch list and seller dashboard?

level: seniorimportance: should knowfreq 42%

answer

  1. count the connections the phone keeps
  2. subscriptions per screen, not sockets
  3. one handshake, keepalive and reconnect
  4. one failure silences every feature
  5. a big message delays the next

basics

~20 s

Share one connection, with per-topic subscriptions each screen adds and drops: the phone pays for one handshake, one keepalive schedule and one reconnect. The costs are a shared failure and one busy topic delaying another, which small messages and priorities contain.

solid answer

~50 s

I'd share one connection and multiplex features over it as subscriptions: the room subscribes to its lot when it opens and drops it when it closes, the watch list adds its lots, and anything that may be minutes old, like the seller's dashboard, is simply fetched and needs no subscription. Every extra connection brings its own TLS handshake, its own keepalive traffic waking the radio, its own credential refresh and its own reconnect after each network switch, which adds up on a phone. The price is coupling: one dead connection silences every live feature, a large message on one topic delays the next on the same ordered connection, and the client must restore every topic after a reconnect. I'd split only for a real reason - another backend or security domain, or a heavy stream that would starve the room.

go deeper

for a junior

Recall that every connection a phone holds has its own setup and upkeep, so features can share one by subscribing to topics.

for a middle

Explain what each extra connection costs - handshake, keepalives, credentials, reconnects - and how screens subscribe and unsubscribe on a shared one.

for a senior

Show the costs of sharing and how to contain them: one reconnecting state, small messages with prices first, server-side coalescing, and resubscribing from a registry.

for a principal

Set the rule for when a team may open a second connection - a different security domain, a stream that starves others, a feature that must outlive the shared one - and when it may not.

## What the choice is about A mobile auction app has several things that could be live at once: the bidding room's prices, the prices of watched lots, and a seller's sales as they happen. Each could get its own connection, opened and owned by its screen. Or the app could hold **one connection** and **multiplex** features over it, each screen **subscribing** to the topics it needs - `lot:812`, `seller:44:sales` - and unsubscribing when it goes. Not every feature has to be live at all: a dashboard that may be a few minutes old can be fetched on open and needs no subscription. ## What each extra connection costs a phone - **Setup.** A TCP and TLS handshake, then an upgrade or a held request, each a round trip on a slow link. - **Keepalive traffic.** Every held connection needs periodic traffic so middleboxes do not drop it, and each send wakes the radio. Uncoordinated keepalives across several connections are exactly the radio waste that consolidating into one session avoids. - **Credentials.** Each connection presents and refreshes its own token. - **Reconnects.** After every network switch each connection fails and reconnects on its own schedule, multiplying the burst of work at the worst moment. - **Server load.** Each phone holds several slots on the gateway instead of one. ## What sharing costs - **A shared fate.** If the one connection dies, every live feature goes quiet until it returns, so the UI needs one honest "reconnecting" state. - **Head-of-line delay.** One connection delivers its messages in order, so a large or bursty message on one topic delays the price event queued behind it. - **Subscription bookkeeping.** The client keeps a registry of active topics and restores them after every reconnect; how the connection itself recovers is a separate design. - **A one-way stream cannot take subscribe messages.** The phone cannot write into it, so changing topics means a separate request tied to the stream, or reopening it with a new topic list. ## Side by side | Concern | One connection per feature | One shared connection | |---|---|---| | Handshakes and keepalives | one set per feature | one set | | A connection failure | affects one feature | affects every live feature | | Delay between features | none | possible; needs small messages and priorities | | Subscribe and unsubscribe | open or close a connection | a message or request per topic | | After a network switch | several reconnects at once | one reconnect, then resubscribe | ## A quick count Suppose, as this scenario's assumption, that each held connection needs a keepalive every 30 seconds to stay open through the networks the app sees. A bidder with the room open, a watch list streaming and a dashboard streaming on three separate connections can wake the radio three times in each 30-second window, because nothing aligns the three timers. One shared connection wakes it once, and a price event that is already flowing can make the keepalive unnecessary. For the watch list and the dashboard, whose events are rare, that keepalive upkeep rather than the events is most of what each extra connection costs. ## How to share well 1. Own the connection in one place in the app, not in screens; screens ask it for topics. 2. Subscribe when a screen appears and unsubscribe when it goes; close the connection when no topic remains or the app leaves the foreground. 3. Keep messages small and send prices first, so nothing large sits in front of them. 4. Let the server coalesce slow topics - the latest sales total replaces the previous one instead of queueing behind it. 5. On reconnect, restore every topic from the registry, each from its last applied sequence. ## When to split Separate connections are right when there is a real reason: a different backend or security domain the shared gateway cannot reach; a high-volume stream that would starve everything else even when coalesced; or a feature that must keep working when the shared connection is down. Without such a reason, more connections are more cost for the phone, not more reliability - and in the background none of them survives anyway.

  • With a one-way stream, how does the bidding room add its lot to the shared connection?
    The phone cannot write into a one-way stream, so it changes its subscription with an ordinary request - add this lot to my stream, tied to the stream's id - or reopens the stream with the new topic list. A socket lets it send the subscribe message on the connection itself. Either way the room shows a fetched snapshot until the server confirms and events start.
  • How do you stop a seller's busy sales feed from delaying a bidder's final-minute prices?
    Do not let one feed flood the shared connection: the server coalesces dashboard updates to a few per minute, latest wins, and writes price events first, keeping messages small so nothing large sits ahead of them. Better still, the dashboard need not be live at all; fetch it on open. If neither is possible, that is the case for a separate connection.

  • Extra connections cost nothing once the radio is already awake.
  • Sharing a connection means every feature stays subscribed all session.
  • Topics on one connection never delay each other, however large a message is.
  • A one-way stream accepts subscribe messages from the phone on the same connection.