File: readme.md

package info (click to toggle)
golang-github-centrifugal-centrifuge 0.15.0%2Bgit20210306.f435ba2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,612 kB
  • sloc: javascript: 102; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 842 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
In this example we show how to connect several Centrifuge server nodes with Redis – thus making it possible to scale nodes.

Start 2 Redis servers locally (we could use just one actually, but here we show builtin Redis sharding feature):

```
redis-server --port 6379
```

And another one on port `6380`:

```
redis-server --port 6380
```

Then start 2 instances of this app on different ports:

```
go run main.go -port 8000
```

And:

```
go run main.go -port 8001
```

Then go to http://localhost:8000 and to http://localhost:8001 in another browser tab. You will see simple chat app in both browser tabs, try writing a chat message in one browser tab – you should see it appears in another tab.

This example uses two Redis instances so published messages will be automatically sharded among them (consistently sharded by a channel).