Make it earn its way in
Reach for boring HTTP first and make WebSocket earn its way in.
Rule it out immediately for request-and-response work: fetching a profile, submitting a form, listing orders. Plain HTTP hands you caching, retries, safe repeats, CDN offload, status codes, and every debugging tool ever written.
Tunnel those calls through a socket and you forfeit all of it to save header bytes that HTTP/2 was already compressing.
Check your platform second. Serverless stacks treat a long-lived connection as a foreign object, billing per connection-minute and per message, with a routing model that surprises everyone the first time. CDNs cannot cache socket traffic.
Expect every hop in your path to acquire an opinion about connections that live for hours, from balancer timeouts to proxy settings to how long a pod is allowed to take shutting down.
What your clients are actually doing
Check your clients third, because they cut the same way. Phones hop between towers and wifi constantly, so a mobile socket feature is really a reconnect-and-resume state machine with a socket attached. Holding the radio warm for a channel delivering three events a day shows up in somebody's battery report.
Test it on frequency, which is the honest measure. Events spaced minutes or hours apart belong on polling or on server-sent events. Only sustained high rates or genuinely two-way traffic, shared editing, gameplay, market data with orders going back, pays for a fleet.
Take none of this as a case against WebSocket, only against defaulting to it. The products that run sockets do it because their work is socket-shaped: constant, two-way, latency-sensitive. A notifications bell is none of those, and the cheaper tools earlier in this course deliver it with a fraction of the moving parts.
Worked example
A B2B analytics startup ships in-app notifications over WebSocket because a competitor's job posting mentioned it. Average delivery: 4 notifications per user per day. Over two quarters the connection layer generates 11 production incidents: idle timeout mismatches after an Nginx upgrade, a reconnect loop that DDoSed their own auth service from mobile clients, phantom connections inflating memory. Meanwhile the actual requirement, a bell icon that updates within a minute, never needed any of it. Fatima replaces the whole layer with a 45 second poll against a cached endpoint during a hack week, deletes about 3,000 lines including the reconnect state machine, and the feature's incident count goes to zero. The postmortem's summary line: we built for the message rate we wished we had.