Streaming API websocket stops sending messages

Hi comunity,

I’m using Daml SDK 1.16.0 with a Sandbox ledger and JSON API. I’ve used the Websocket, provided by /v1/stream/query API to listen a Contract’s events. After 2h it stops sending messages, but the connection seems to be open, at least I can send ping frames. Do I have to setup any additional configs to have longer connections ? Or is it some limitation from JSON API ?

1 Like

Hi @rui.genesis, take a look at the corresponding Github issue. Right now this is expected behavior to avoid resource leakage.

The JSON API allows you to reconnect and continue streaming at a given offset once your connection gets lost.

Depending on your network setup your connections might also be much shorter. IIRC the google load balancer kills connections after 2 minutes rather than 2 hours.

4 Likes

Hi,
Thank you for your answer. I will use your suggestion, using a strategy to renew connections.

1 Like