Go Random Chat
Fast and scalable real-time random chat written in go.
Features:
- Real-time communication and efficient websocket handling using Melody.
- Stateless chat servers with the help of Redis Pub/Sub.
- We are not using Redis Stream here since at-most-once delivery is enough for transient messages. Thus, there is chance of data loss during matching and chatting stages.
- If you want at-least-once delivery for message fan-out, please consider using brokers such as NATS and Kafka. The following examples show how to interact with these brokers using go client.
- High performance and linear scalability with the help of Redis Cluster.
- User Matching with idempotency.
- Responsive web design.
Usage
./run.sh run
This will spin up all services declared in docker-compose.yaml
. Visit localhost
and you will see the application home page.
Environment variables:
HTTP_PORT
: Opened port of HTTP serverREDIS_PASSWORD
: Redis passwordREDIS_ADDRS
: Redis node addressesREDIS_EXPIRATION_HOURS
: The expiration of all Redis keys (in hour). Default:24
MAX_ALLOWED_CONNS
: Max allowed connections to the server. Default:200
MAX_MSGS
: Max number of messages in a channel. Default:500