Bitpath

Boss lesson · Unit 04

Design a chat app

Open connections, ordered messages, and offline users

13 exercisesabout 3 min

What you practise

  • WebSockets vs polling, delivering to offline users, ordering within a conversation, presence, group fan-out, storing history, and what breaks first at scale

Try a question from this lesson

Pick one

Bo sends Ana a message while her app is open. With plain HTTP, where the client asks and the server answers, how does her phone find out?

The idea

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

WebSockets

A WebSocket starts as an HTTP request and is upgraded into one long-lived connection. After that, either side can send at any moment.

The server pushes a message the instant it arrives, with no asking. The price: each gateway server holds many thousands of open connections, and the system must remember which gateway holds whom.

Polling     C: new?   S: no
            C: new?   S: no
            C: new?   S: yes, 1 msg

WebSocket   C <===== open =====> S
            either side sends, any time

11 more exercises in the app

  • 3× type the answer
  • 6× multiple choice
  • 1× order the lines
  • 1× true or false

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy