Remotely control pvserver from web app that uses vtk.js


I would like to use RemoteView to show CFD simulations results. Results are processed by pvserver, which already has a reader for the data format, and the client application should control pvserver to set up what is shown in RemoteView via vtk.js

So far, I’m able to start pvserver with a python script, load data, and visualize in RemoteView.

However, it is not clear to me how the client can select what is being shown (e.g., what fields, with what color map and data range). In other words, how can pvserver be dynamically controlled from the client? Is there an API and some documentation on how to do so?

I saw the post [RemoteView] Does VTK remoteview support dynamic input source? and the vue example shown there, which seems to rely gRPC calls. Is there any documentation for these?

Note: the client app is not based on trame or vue, hence why I’m looking for a way to communicate with pvserver that doesn’t rely on these two tools.

Thank you for any guidance you can give!

Since you have the RemoteView working, you already have wslink fully setup (which is not gRPC).

From there, you can register more server side (Python) methods to be callable from the client which is exactly what is shown in the vue based template example. If you ignore the vue side of that example, you have the JavaScript code that is needed to make server call.

1 Like

Thank you, @Sebastien_Jourdain

I understand that you can export methods when starting pvserver using @exportRpc (sorry for my typo, I wrote gRPC out of habit). Am I correct in thinking I must export all the methods the client will call first in python, or can existing vtk methods be added from the client?

The server needs to list every methods that he wants to client to have access to.
After that, the client can call any of them dynamically.

Usually on the server side, you create some kind of facade that will allow you to create a few set of methods that can dynamically call many other methods on existing objects.

With the ParaView backend, you can easily update proxies via pre-existing protocols.



1 Like

Sounds good: thank you for your help and clarifications.