I made a CLI chat app because I wanted to understand scaling services that have stateful websockets.
The main topic this project demonstrate was a scalable architecture for a system that uses websockets to communicate with clients.
Inspiration: https://www.youtube.com/watch?v=hl3_MANBiyc
The setup we are tring to achieve locally is here. (Image generated by diagrams.py in ./media
directory)
cd media
pip install -r requirements.txt
- Download graphviz and add it to your PATH https://graphviz.org/download/
python diagrams.py
- Build server image.
cd server
docker build --platform=linux/amd64 -t golang-chat-server .
- Run docker compose to spin up 2 servers and rabbitMQ.
docker compose up
- In 2 new terminals, start 2 respective clients connecting to the seperate servers.
cd client/src
go run main.go localhost:8080
go run main.go localhost:8081
- Happy chatting.