[Paraview] how to make a new protocol
Sebastien Jourdain
sebastien.jourdain at kitware.com
Sat Mar 3 12:10:06 EST 2018
Hi Tom,
The array list should only contain the names that belong to that directory:
https://github.com/Kitware/paraviewweb/tree/master/src/IO/WebSocket/ParaViewWebClient
Then your custom protocol should looks like:
https://github.com/Kitware/paraviewweb/blob/master/src/IO/WebSocket/ParaViewWebClient/ProxyManager.js
Except that you will need to nest it inside an object like:
{
CustomProtocol1: [...content of the previous example...],
CustomProtocol2: [...content of the previous example...],
}
Then to use it you will do:
client.CustomProtocol1.availableSources().then(...
You can find a live example of its usage here:
https://github.com/Kitware/divvy/blob/master/Sources/client.js#L27-L65
HTH,
Seb
On Fri, Mar 2, 2018 at 5:02 PM, Sgouros, Thomas <thomas_sgouros at brown.edu>
wrote:
> 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/20180303/f910b75f/attachment.html>
More information about the ParaView
mailing list