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 (13 lines) | stat: -rw-r--r-- 778 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
This example demonstrates a simple chat with manual paginated message recovery from a history stream.

**This example does not cover all edge cases** (error handling, handling disconnects while recovery in process left as an exercise for a user) - it mostly shows the use of API to iterate over history from client side.

Client subscribes on a channel, on first subscribe we save a channel current stream position to a variable, then on reconnect (which is artificially initiated by a server) we try to restore messages from server history – we do this in chunks calling `history` method with `since` and `limit` filter params.

To start example run the following command from example directory:

```
go run main.go
```

Then go to http://localhost:8000 to see it in action.