- This app proofs that websocket server scales horizontally.
- Every backend connects to a Redis (PUB/SUB)
- Backend has only 2 files.
- The backend is a native Deno app without a library. It just needs a Redis client library.
- The main file is websocket/main.ts
- The frontend app is a web framework written in Deno called fresh
- Install Docker to you PC
- Then execute these comments by one one
docker swarm init
docker compose build
docker stack deploy -c docker-compose.yaml ws-app
- Open this URL in your browser with a couple tabs http://localhost:8000
docker service update --replicas 1 ws-app_backend
docker service update --replicas 10 ws-app_backend
docker stack rm ws-app