C.W.K.
Stream
Lesson 03 of 05 · published

Paused by Default

~11 min · opt-in, calm-default, resource-safety, low-trigger

Level 0Open Gate
0 XP0/36 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete
"The stream is off until you ask for it. Calm is the default; live is the button you press on purpose."

The resting state is silence

Most finance apps stream the moment they open — the numbers start twitching before you've even focused your eyes. Keep does the opposite. Browser REST polling and the WebSocket streams are paused by default. When you open Keep, you see the durable, dated close sitting still. A large, persistent Resume control turns on the live overlay — the three-second browser sync and both Massive stream subscriptions — only when you actually want live observations. Live is a deliberate act, not the ambient condition.

Why the default direction is the whole philosophy

Defaults are where a product's real values live, because most people never change them. An app that streams by default has decided that constant live motion is the normal way to look at your money. Keep decided the opposite: the normal way is a calm snapshot, and live is a temporary tool you pick up when you have a specific reason. This is the low-trigger north star expressed as a single boolean's default value. Flip that default and you've quietly changed what kind of app it is.

The default is the product's actual opinion. Features behind a toggle are optional; the default state is what you're telling every user is normal. Choosing 'paused' as the default isn't laziness or a performance hack — it's a statement that calm observation, not live motion, is the intended relationship with the data.

The opt-in guard: why each socket must say live=1

There's a subtle resource-safety rule underneath. It isn't enough for the UI to be paused — each WebSocket must carry an explicit live=1 opt-in for the server to actually stream provider data over it. Why? Because an old browser tab, left open from before a Pause, could otherwise reconnect and quietly keep an upstream provider hub alive, burning the data entitlement even though no human is watching. By requiring the explicit opt-in per socket, a stale pre-Pause tab gets only a local terminal "paused" connection — it can't resurrect the live feed on its own. Pause has to mean paused everywhere, including for zombie tabs.

A paused UI with an un-guarded socket isn't really paused. If the client controls whether streaming happens, a forgotten tab or a replayed connection can keep the upstream alive behind your back. The server must independently require the opt-in, so 'paused' is enforced at the source of the data, not just hidden in the UI. Trust the button on the server side, not just the screen.
What Pause actually does. Pausing closes the opted-in streams, clears the browser sync interval, and forces market-pulse reads back onto the last durable cache. The manual refresh button and the unattended 06:31 daily snapshot are explicit exceptions — they can still fetch on demand or on schedule. Pause governs the ambient live stream, not every possible read.

Code

Live requires a deliberate opt-in, enforced server-side·typescript
// Client: streaming is OFF until the user presses Resume.
let streaming = false;   // paused by default — the calm resting state

function resume() {
  streaming = true;
  // Each socket must carry the explicit opt-in, or the server
  // will only grant a local terminal 'paused' connection.
  openSocket(`/ws/stocks?live=1`);
  openSocket(`/ws/indices?live=1`);
  startBrowserSync();
}

// Server: without live=1, no provider hub is kept alive for this socket —
// so a stale pre-Pause tab cannot resurrect the upstream feed by itself.

External links

Exercise

Pick a feature that could either default to 'on/live/streaming' or 'off/calm/manual.' Argue which default the product's values imply, remembering that most users never change it. Then, separately: if the feature streams from a server, design the guard that stops a forgotten client tab from keeping the stream alive after the user 'paused' — where does the enforcement have to live to actually work?
Hint
Two independent ideas here. First: the default IS the opinion — pick it to match the values, not the demo. Second: client-side pause is theater if the server keeps streaming to any socket that connects. Real pause requires the server to demand the opt-in, so a zombie tab can't hold the upstream open.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.