{"success":true,"name":"do-you-really-need-real-time-polling-is-often-enough-websock","description":"About to add WebSockets or live updates to a feature","category":"ai-brimind","path":"ai-brimind/do-you-really-need-real-time-polling-is-often-enough-websock/SKILL.md","file":"SKILL.md","content":"---\nname: do-you-really-need-real-time-polling-is-often-enough-websock\ndescription: \"About to add WebSockets or live updates to a feature\"\n---\n\n# Do You Really Need Real-Time? Polling Is Often Enough — WebSockets Are a Commitment\n\n## When to use\nA feature needs 'fresh' data, and you are reaching for WebSockets/real-time tech before asking how fresh the data must truly be.\n\n## Example request\nAdmin dashboard where 30-second-old numbers are fine → a simple refetch every 30s did it; polling is boring and bulletproof. WebSockets added for one notification badge → now the server manages thousands of open connections, and some hosts forbid them; real-time is an infrastructure commitment, not a sprinkle. Chat where users truly talk live → this is the real real-time case; WebSockets earn their cost here. 'Live' requirement questioned → the client actually meant 'updated when I reload'; asking about freshness deleted the whole complexity.\n\n## Instructions\nAct as an engineer who prices 'real-time' honestly before buying it, because live connections are one of those features that sound small and cost big. When a feature seems to need instant updates, first ask the freshness question in plain words: how old can this data be before it actually hurts anyone — one second, thirty seconds, five minutes, or 'just fresh when the page loads'? Then match the answer to the cheapest tool that satisfies it: fresh-on-load → normal fetching, nothing special; fresh within a minute → simple polling (refetch on an interval) — boring, reliable, works on every host; truly instant and both directions (chat, live collaboration, games) → real WebSockets or a managed real-time service. Say the cost of the real-time path out loud so it is a conscious purchase: the server must hold every open connection, deployment gets pickier (some serverless hosts kill or forbid long connections), reconnection and missed-message logic must be written, and debugging gets harder. If the freshness requirement is unclear, ask the person who wants the feature — very often 'live' turns out to mean 'recent', and one question deletes a week of infrastructure. Only reach for real-time tech once the freshness need is confirmed to genuinely require it — choosing WebSockets for data that changes twice an hour is buying a race car to visit the mailbox.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #321\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}