[Paraview] how to make a new protocol

Sgouros, Thomas thomas_sgouros at brown.edu
Fri Mar 2 19:02:26 EST 2018


How do I learn what to do on the client side? I see the
ParaViewWebClient.createClient() function, and I see that I can add a hash
of custom protocols to it, but when I try, the client complains.

I tried this:

const config = { sessionURL: 'ws://localhost:1234/ws' };
const smartConnect = SmartConnect.newInstance({ config });

const amsProtocols = {
  testbuttonService: function createMethods(session) {
    return {
      testbutton: () => {
        console.log("hi there ******************");
        return session.call('amsprotocol.testbutton',[])
          .then((result) => log('result' + result));
      },
    };
  },
};

smartConnect.onConnectionReady((connection) => {
  const pvwClient =
        ParaViewWebClient.createClient(connection,
                                       [
                                         'MouseHandler',
                                         'ViewPort',
                                         'ViewPortImageDelivery',
                                         'testbuttonService'       // <---
I thought this...
                                       ],
                                       amsProtocols);              // <---
...was a key into this hash. No?

Obviously I'm misunderstanding something here, but can someone explain what
I'm missing? Where is the structure of a client described?

Do I need to do any of this if all I'm trying to do is to get button
presses and selection widgets to communicate with the pvpython server?

Thank you,

 -Tom

On Thu, Feb 22, 2018 at 11:49 AM, Sgouros, Thomas <thomas_sgouros at brown.edu>
wrote:

> Thank you, I will look at it.
>
>  -Tom
>
> On Thu, Feb 22, 2018 at 11:24 AM, Sebastien Jourdain <
> sebastien.jourdain at kitware.com> wrote:
>
>> LightViz will be a good example as it defines a custom set of protocols
>> instead of using only the default ones like in Visualizer.
>>
>> https://github.com/Kitware/light-viz/tree/master/server
>>
>> On Thu, Feb 22, 2018 at 6:59 AM, Sgouros, Thomas <
>> thomas_sgouros at brown.edu> wrote:
>>
>>> Hello all:
>>>
>>> Can someone describe the steps necessary to create and use a web socket
>>> connection between a Paraviewweb client and a pvpython server? I am not
>>> having much luck finding the documentation for registerVtkWebProtocol()
>>> which appears to be an important part of the process. Google only helps me
>>> find pvw-visualizer.py, which I'm sure is useful code, but I'm having a
>>> hard time making much sense of it as an example.
>>>
>>> I would appreciate even just being pointed to the vtk python code, but
>>> I'll take any pointers you can offer.
>>>
>>> Thank you,
>>>
>>>  -Tom
>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the ParaView Wiki at:
>>> http://paraview.org/Wiki/ParaView
>>>
>>> Search the list archives at: http://markmail.org/search/?q=ParaView
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> https://public.kitware.com/mailman/listinfo/paraview
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/paraview/attachments/20180302/97c51442/attachment.html>


More information about the ParaView mailing list