How to stream events from a specified offset using json-api?

I tried sending out this message to WebSocket to listen the events from the given offset. Got a WebSocket connection closure. I can’t find any example in DAML docs, is this the right way?

daml json-api --ledger-host localhost --ledger-port 6865 --http-port 7575 --application-id IouApp --websocket-config maxDuration=120,heartBeatPer=5

Message sent:

[{“offset”: “00000000000000080000000000000000”}, {“templateIds”:[“e7d9277285b7bca99a69d3658c542ce24ba35f38b6234c462f33f37322380901:TestingToolkit.Master:Master”, “e7d9277285b7bca99a69d3658c542ce24ba35f38b6234c462f33f37322380901:TestingToolkit.Master:Wallet”, “e7d9277285b7bca99a69d3658c542ce24ba35f38b6234c462f33f37322380901:TestingToolkit.Coin:Coin”]}]




The offset should be sent as a separate message, not within the array of queries.

However, it is worth noting that you should only ever use an offset that you got from a previous query. The streaming API is still a state-based API not an event-based API and not targeted at usecases like streaming all events since the beginning. Offsets are mainly there as an optimization: If you have a large ACS, streaming only the delta since the last offset can be faster than starting with a full ACS query again.

If you do really want individual transactions and events since a given ledger API offset, you have to resort to the gRPC API for now.