Websocket connection not getting closed

Hi Team,
I was trying to use daml useStreamQuery hook to get the updated result over websocket connection. But when i am unmounting component still i see those websocket connection in pending state for sometime, and later it opens another set of websocket connection for same queries for the same unmounted component. Could anyone help me in resolving this issue?

1 Like

Hi @Vivek-kapoor,

Thanks for the report! I have been able to reproduce a similar issue, and am working on a fix. I’ll let you know when the fix is available for testing.

2 Likes

Hi again,

I believe I have fixed the root cause for this issue in this PR, though I unfortunately missed today’s snapshot release. I will ping you again here when we make a release that includes that change (likely next Wednesday).

In the meantime, a workaround could be to set a very long reconnectThreshold value, as the current implementation will only reconnect if the connection was active for longer than that value (given in milliseconds, defaulting to 30 000, i.e. 30s).

2 Likes

Thanks @Gary_Verhaegen for the quick reply.

Hi @Vivek-kapoor,

Can you try with 1.6.0-snapshot.20200922.5258.0.cd4a06db? Run:

daml install 1.6.0-snapshot.20200922.5258.0.cd4a06db

then update your JS deps accordingly, clean and rebuild everything (including updating dependencies).