Python VTK server + Remote View with VTK.js + multiple users


I currently have a setup where I have a python web server using a vtk wheel and wslink to create a server and I have an javascript client connecting to it and I can load my models on the server and see them successfully on the client.

However, I want to create a multi-user setup where each user logs in to his account and creates a new session.

I am wondering if I should create my own custom code to achieve this or if you guys have this functionality built in.

I have seen this page:

Is this the approach I should be exploring? Or is there another way of achieving the same result?
Is there any more documentation or examples on this topic?

Thank you.

wslink provide the python launcher module which allow you to start a new process per user session. At that point you only need to configure it and the same is true with Apache.

So in short, you have all the pieces, but you need to configure them so they can work together and that documentation explain the role of each and what you should do to configure them.

Thank you Sebastien, I managed to get a working version. However I have a couple of questions:

Is there an example using nginx?

Also I think there’s a problem with wslink version 1.1.0 in the client, if I use version 0.1.15 in the client it works but if I use 1.1.0 on the client this error pops:

Error event: ConnectionReady TypeError: t.protocol.subscribeToImageStream(...).then is not a function
    at Object.e.connect (index.js:54)
    at Object.<anonymous> (index.js:134)
    at index.js:105
    at Array.forEach (<anonymous>)
    at l (index.js:102)

One more thing, if I close the browser tab, the process keeps going on the server, is this a mistake on my end or what can I do to close the session (plus the python process running on the server) once a user closes his tab?

Thank you very much.

I don’t have an example with nginx on hand.

There is indeed a breaking change in wslink 1.1 vs 0.1 but using vtk 9.1 with latest vtk.js should be just fine.

When you close your tab the process should go away after a timeout. I think the default is 300 seconds. But you can make it shorter if you provide the argument --timeout 10 for example.

Hi @Sebastien_Jourdain, I have tried using the “–launcher” argument while running trame application with multi user support. However, a new session window is opened even on refreshing the browser page. I have added “–timeout 30” to close older sessions But, I’m having doubt if the new session window should open on page refresh.

Yes, that is the expected behavior unless you make it so that a page reload should reconnect to the same running session.

In general the --launcher is not meant to be use outside of a test-out environment as many port get used.

Thanks @Sebastien_Jourdain. For deployment I found this link where you have mentioned about docker. Will try it out.