Proper way to close a vtkRemoteView / vtkWSLinkClient

Hi,
So I have a front-end including a vtkRemoteView connecting to a remote paraview server via wslink (based on the last code here vtk.js).

Everything works well on first visualisation, however when the customer closes the visu window, I need to close the connection cleanly.
So I call disconnect() on the WSLinkClient, then delete() on the vtkRemoteView.
Disconnect seems to work as for server, the client is disconnected (it logs INFO:root:client xxx disconnected)

Thing is, if the user tries to re-connect to the server, visualisation doesn’t work and it generates errors like {code: -32099, message: 'RPC call viewport.image.push.original.size unsuccessful: connection not open'}. Yet I recreate the remoteView and wsLinkClient. But it seems there is some previous connection that is kept. Is it some state in wslink/vtk-js?

Indeed in wslink’s session.js, model.ws.readyState is 3; so it seems the old websocket is conserved. But I can’t find why, as it seems I recreate everything.
So maybe it’s because I don’t call the right destructors ?
is wslinkclient.disconnect() on then remoteView.delete() the appropriate calls to properly close a session?

Thanks in advance,

Hi Eino,

Could you create a minimal example that we can work on to debug that use case?
That would help to speed up the process on our side.

Thanks,

Seb

1 Like

Hi Sebastian,
thanks for your answer, I’ll do that. (maybe it can even point out something that I did wrong during recreation).
I’ll keep you posted :slightly_smiling_face:

1 Like

Hi, so I created a minimal Vue application, that I pushed here (visualisation code is in components/HelloWorld.vue).

It can be ran with npm run serve and connects to a paraview server running on localhost:1234.
First time, a click to visualise works well, but after closing, a second visualisation just gives a blank view with errors in the console (especially if trying to drag mouse in the visu view).

I tried to track where the connection is kept, but the call stack is not easy to follow.
Thanks!