| 1 |
In this example we show how to use `Node.Survey` to collect channel information from all running Centrifuge nodes. |
| 2 |
|
| 3 |
Start Redis server locally: |
| 4 |
|
| 5 |
``` |
| 6 |
redis-server |
| 7 |
``` |
| 8 |
|
| 9 |
Start first example instance on port 8000: |
| 10 |
|
| 11 |
``` |
| 12 |
go run main.go -port 8000 |
| 13 |
``` |
| 14 |
|
| 15 |
Then start another example instance on port 8001 (in another terminal): |
| 16 |
|
| 17 |
``` |
| 18 |
go run main.go -port 8001 |
| 19 |
``` |
| 20 |
|
| 21 |
Go to http://localhost:8000 and to http://localhost:8001 in another browser tab. Clients will subscribe to channels (each to its `window.location.host`), each second survey will ask for all active channels with number of subscribers from all running nodes. |