Real-Time (WebSockets and SSE)
Techniques for pushing live updates from the server to the browser without the user refreshing the page.
Real-time features update the UI instantly when something changes: a new chat message appears, a notification badge increments, a dashboard chart updates with live data. The two main technologies are WebSockets (full duplex, bidirectional) and Server-Sent Events (SSE, server to client only).
WebSockets create a persistent connection between browser and server. Either side can send messages at any time. They are ideal for chat, collaborative editing, and multiplayer features. SSE is simpler: the server pushes events to the client over a regular HTTP connection. It is perfect for notifications, live feeds, and AI streaming responses.
For vibe coders, real-time is an architectural decision that affects your entire stack. AI can generate WebSocket handlers and SSE endpoints, but you need to decide whether the feature truly needs real-time updates or if simple polling (checking every few seconds) is good enough for your use case.