Streaming / UX

Sync & Broadcast

Pushing information to your screen the moment it happens. You see changes instantly without ever needing to hit the refresh button.

1 Polling vs WebSockets

Ask once. Get told when something changes.

Polling is asking "anything new?" every second. Most answers are no. A WebSocket opens a tunnel that stays open. The server pushes news the moment it happens. Less waste, lower delay.

Watch polling burn requests asking nothing. Watch the socket sit quiet until news arrives.

2 Channels

Send the message to only who should see it

Not every event is for everyone. A public channel sends to all users. A private channel sends to one. A presence channel knows who's currently in the room. You pick the channel; the server handles delivery.

Press Public to shout at everyone. Press DM to whisper to one user.

3 Heartbeat

Send a ping every few seconds to check the line

Connections can die silently. A short ping every few seconds confirms the line is still alive. If a ping or pong is missed, the client drops the connection and tries to reconnect. No more zombie sockets.

Press the button to fake a lag. Watch the heartbeat fade and a reconnect kick in.

4 Redis Pub/Sub

Share events across many WebSocket servers

One server can hold a few thousand connections. To serve millions of users you need many servers. Redis Pub/Sub sits in the middle. Any server can publish an event, and every other server hears it instantly. From the user's view, it's one big real-time system.

Many WebSocket servers, one Redis in the middle. An event published once reaches all of them.

Need Instant Updates?