Daily iOS
iOS system design

Online presence

You're adding an online/offline/last seen indicator to a contact list. Given that the app might be force quit or lose its connection and never get to announce it's offline, how would you design the way the client reports its own status to the server?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

Report your own status through foreground enter/exit events plus a socket heartbeat, and let the server decide offline by timeout. For other users, subscribe only to those visible on screen, and the server sends deltas only when something changes.

Share a question