A high-performance, production-ready WebSocket chat server built with Go. GoChat provides real-time multi-client communication with built-in security features, comprehensive testing, and cross-platform support.
- Real-time Communication - WebSocket-based instant messaging
- Multi-client Support - Handle thousands of concurrent connections
- Built-in Security - Origin validation, rate limiting, and message size limits
- Production Ready - Comprehensive testing, CI/CD pipeline, and deployment guides
- Cross-platform - Build and run on Windows, macOS, and Linux
- Zero Dependencies - Statically linked binaries with no external runtime dependencies
- Docker Support - Production-ready containerization with multi-stage builds
- Environment Configuration - Easy configuration via environment variables
- Easy Deployment - Simple binary or container deployment with reverse proxy support
# Clone the repository
git clone https://github.com/Tyrowin/gochat.git
cd gochat
# Build the server
make build
# Run the server
./bin/gochat# Using Docker Compose (recommended)
docker-compose up -d
# Or build and run manually
docker build -t gochat:latest .
docker run -d -p 8080:8080 --name gochat gochat:latestGoChat can be configured using environment variables. Copy .env.example to .env and customize:
cp .env.example .env
# Edit .env with your settingsThe server starts on http://localhost:8080. Visit http://localhost:8080/test to try the interactive test page.
- Getting Started Guide - Installation, building, and running the server
- API Documentation - WebSocket API reference and code examples
- Deployment Guide - Production deployment with Nginx/Caddy, TLS/WSS setup, and process management
- Security Documentation - Security features, configuration, and best practices
- Development Guide - Development setup, testing, and CI/CD
- Building Guide - Build instructions and cross-compilation
- Contributing Guide - How to contribute to the project
GoChat follows a clean, modular architecture:
Client (Browser/App)
↓ WebSocket (ws:// or wss://)
Reverse Proxy (Nginx/Caddy)
↓ HTTP
GoChat Server (Go)
├── Hub (Message Broker)
├── Clients (WebSocket Connections)
└── Security (Rate Limiting, Origin Validation)
- Hub - Central message broker coordinating all connected clients
- Client - WebSocket connection handler with read/write pumps
- Rate Limiter - Token bucket per-connection rate limiting
- Origin Validator - CSWSH attack prevention
- Handlers - HTTP/WebSocket request handlers
See Development Guide for detailed architecture information.
- Language: Go 1.25.1+
- WebSocket Library: gorilla/websocket
- Testing: Go standard library + custom test helpers
- CI/CD: GitHub Actions
- Code Quality: golangci-lint, gosec, govulncheck
GoChat is actively maintained and production-ready. We welcome contributions!
- Stability: Stable, used in production
- Test Coverage: 80%+ with unit and integration tests
- Security: Regular dependency scanning and security audits
- Performance: Handles thousands of concurrent connections
- Chat Applications - Real-time messaging systems
- Live Notifications - Push notifications to web clients
- Collaborative Tools - Real-time collaboration features
- Gaming - Multiplayer game communication
- IoT - Device-to-server real-time communication
- Monitoring Dashboards - Live data updates
- Issues: GitHub Issues - Bug reports and feature requests
- Discussions: GitHub Discussions - Questions and community chat
- Contributing: See Contributing Guide
- Security: See Security Policy
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with gorilla/websocket
- Inspired by the Go community's best practices
- Thanks to all contributors
Ready to get started? Check out the Getting Started Guide or explore the API Documentation to integrate GoChat into your application.