Realtime & WebSockets Interview Questions (Flutter)
6 Realtime & WebSockets questions from the Flutter track. Read each short answer here, then open a question for the full explanation, examples, common mistakes, and sources.
- Junior
When do you choose a WebSocket over HTTP polling in a Flutter app?
A WebSocket suits near-instant two-way updates, while polling is simpler for rare updates.
Read the full explanation - Mid-level
How do you represent realtime connection states in Flutter?
Use clear states such as connecting, connected, disconnected, and error instead of scattered flags.
Read the full explanation - Mid-level
How do you design a safe WebSocket reconnect?
Use exponential backoff with a cap and jitter, and stop attempts on dispose or logout.
Read the full explanation - Senior
How do you handle message ordering and duplication after a reconnect?
Use a message id or sequence number and apply idempotency per a clear contract.
Read the full explanation - Junior
How do you prevent a StreamSubscription leak in a Flutter screen?
Keep the subscription and cancel it in dispose, and do not subscribe inside build.
Read the full explanation - Senior
What happens to a realtime connection when the session ends or on logout?
Stop sending, close the connection, and clear the listeners and private data before allowing a new connection.
Read the full explanation