Add Real-Time Chat to My App
Start here: the classic WebSocket use case From the WebSockets AI Coding Building Block.
Add a real-time chat feature to my app using WebSockets. Framework: [Express + Socket.io, Django Channels, FastAPI WebSockets, etc.] I want: 1. Users can send messages and see them appear instantly 2. All connected users see new messages in real-time (no page refresh) 3. Show a simple "user is typing..." indicator 4. Handle what happens when someone disconnects Keep it simple: just the core chat functionality. Show me: - The server-side WebSocket setup - The client-side JavaScript to connect and send/receive messages - How messages get broadcast to everyone I'm learning WebSockets for the first time, so explain each part simply.