• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..18-Oct-2021-

main.goH A D18-Oct-20214.3 KiB177145

readme.mdH A D18-Oct-2021778 148

readme.md

1This example demonstrates a simple chat with manual paginated message recovery from a history stream.
2
3**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.
4
5Client 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.
6
7To start example run the following command from example directory:
8
9```
10go run main.go
11```
12
13Then go to http://localhost:8000 to see it in action.
14