GoChat is a high-performance distributed instant messaging system built with Go, featuring a microservices architecture and custom RPC framework.
-
Gateway Server 🌐
- Handles TCP connections and message routing
- Uses epoll for high-performance I/O
- Manages connection lifecycle
- Communicates with State Server via gRPC
-
State Server 💾
- Manages user session state
- Handles message persistence
- Coordinates between Gateway and IPConf
-
IPConf Server 🔧
- Service discovery and configuration
- Load balancing
- Service health monitoring
-
Custom RPC Framework (CRPC) ⚡
- Built on top of gRPC
- Service discovery integration
- Load balancing support
- Tracing and metrics
- High-performance TCP connection handling with epoll
- Custom RPC framework for service communication
- Service discovery and load balancing
- Distributed architecture
- Real-time message delivery
- Session state management
- Metrics and tracing support
- Go 1.22 or higher
- Protocol Buffers compiler
- Docker (for Redis and etcd services)
- Make
We provide a script to start all required external services (etcd and Redis):
chmod +x scripts/start-services.sh
./scripts/start-services.sh# Build all components
make all
# Start services in different process
./bin/gochat state
./bin/gochat gateway
./bin/gochat ipconf
./bin/gochat clientYou can verify the services are running correctly:
# Check etcd
curl http://localhost:2379/version
# Check Redis
redis-cli ping- User authentication and authorization
- Message persistence with Redis
- Group chat functionality
- Message delivery status
- File transfer support
- Voice messages
- Message encryption
- User presence system
- Horizontal scaling support
- Message queue integration
- Cache layer implementation
- Performance optimization
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.

