A simple WebSocket-based chat application.
- Real-time messaging
- Online users tracking
- Message history (last 20 messages)
- Join/leave notifications
Backend: Go, Gorilla WebSocket
Frontend: Vanilla JavaScript, Tailwind CSS
go run cmd/server/main.goOpen http://localhost:8080
├── cmd/server/ # Entry point
├── internal/
│ ├── app/ # Application setup
│ ├── handler/ # HTTP & WebSocket handlers
│ ├── logger/ # Logging utility
│ └── ws/ # WebSocket logic (Hub, Client)
└── chat-frontend/ # SPA frontend
- Hub pattern manages all client connections
- Go channels handle concurrency safely
- Single-page application with custom router
- WebSocket for real-time bidirectional communication