Interview practice question
Only one tab should hold the real-time connection
Frontend Engineering · Async JavaScript and the Browser · Experienced
Users open your app in many tabs, and each opens a WebSocket, overloading your servers. How would you share one connection across tabs?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Leader election via Web Locks.
- Leader opens WebSocket, broadcasts via BroadcastChannel.
- Followers send outgoing messages through leader.
- Failover when leader closes.
- SharedWorker alternative.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.