1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
This example shows how to use custom Broker implementation based on [Nats](https://nats.io/) messaging server. Here Nats handles PUB/SUB stuff while presence information managed by Redis.
Nats Broker does not support any methods related to publication history – it only provides at most once PUB/SUB.
Start Nats server locally:
```
go get github.com/nats-io/nats-server
nats-server
```
Start Redis (for handling presence):
```
redis-server
```
Finally, to start example run the following command from example directory:
```
go run main.go
```
Go to http://localhost:8000. You will see simple chat app, try writing a chat message in one browser tab and you should see it appears in another tab.
|