A distributed instant messaging system built on WebSocket connections, with group chat, online presence, and HTTP APIs for sending messages.
Overview
goWebSocket is a distributed instant messaging stack that keeps long-lived WebSocket connections to clients while separating message delivery from other business logic. It targets chat scenarios where the server must push data to online users and expose simple APIs to check presence and deliver messages.
The server uses WebSocket for client links and can scale horizontally: multiple instances register in Redis and communicate with gRPC. Nginx can terminate WebSocket traffic and load-balance across machines. Clients join rooms identified by appID, support login and heartbeat commands over JSON, and can send text plus image or voice payloads via file URLs.
Operators clone the project, configure it, and start it with Redis and the Go runtime as dependencies. A built-in web chat page lets users enter a shared room for group chat. HTTP endpoints list room users, query online status, and send messages to one user or everyone; RPC interfaces mirror key operations for internal services.
Documentation in the materials describes nginx WebSocket proxying, connection management with timeouts and heartbeats, and memory estimates for very large numbers of concurrent connections on a single host. Login and authorization are called out as areas still open to hardening.
Key features
- WebSocket long-lived client connections
- Horizontal deployment with gRPC between nodes
- Redis-based service discovery across instances
- Group chat with shared chat room UI
- HTTP APIs for push and presence queries
- JSON login and heartbeat protocol
- Text, image, and voice message formats
- Nginx load balancing for WebSocket and HTTP
Use cases
- Real-time group chat demonstrations
- Keeping persistent links for server push
- Separating IM transport from other backends
- High-concurrency WebSocket connection experiments