WLun001 / scaling-ws

Example of scaling real-time servers, such as Websocket

Home Page:https://blog.yongweilun.me/scaling-real-time-servers-with-nats-part-1-ckf5559jt021qors14c2zan0u

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get started

  • For initial problem, checkout problem branch
  • For nats solution, checkout solution-nats-ws branch
  • For final solution, checkout solution-nats-ws-part2 branch

How to run

solution-nats-ws-part2 branch

# on terminal
# start web ui
cd web
npm i && npm run serve

# open another terminal
# start nats-server
# make sure it is installed
nats-server -c nats.conf

# open another terminal
# start api server
make start-api

Open two tabs on http://localhost:8080

problem branch

# on terminal
# start web ui
cd web
npm i && npm run serve

# open another terminal
# start ws server
go run main.go --addr :4000 --skipWs

# open another terminal
# start api server
go run main.go

Open two tabs on http://localhost:8080

solution-nats-ws branch

# on terminal
# start web ui
cd web
npm i && npm run serve

# open another terminal
# start nats-server
# make sure it is installed
nats-server

# open another terminal
# start api server
make start-api

# open another terminal
# start ws server
make start-ws

Open two tabs on http://localhost:8080

About

Example of scaling real-time servers, such as Websocket

https://blog.yongweilun.me/scaling-real-time-servers-with-nats-part-1-ckf5559jt021qors14c2zan0u

License:MIT License


Languages

Language:Vue 63.9%Language:Go 20.2%Language:HTML 11.1%Language:JavaScript 3.8%Language:Makefile 1.0%