Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How to choose the binding to use on client side when thing description has several ? #199

Closed
franckOL opened this issue Apr 3, 2020 · 6 comments

Comments

@franckOL
Copy link

franckOL commented Apr 3, 2020

For exemple i get a TD by http request by want To interact with websocket. Aldo i m not able To get the TD by websocket channel

@egekorkan
Copy link
Member

This is not possible at the moment but there are discussions on it in the Scripting API task force. For now, I would suggest to etiher:

  • fetch the TD and remove the unwanted forms
  • do not include other bindings than websockets

Regarding use of WS, it seems that the client side is not implemented at all. All the methods here do nothing

@franckOL
Copy link
Author

franckOL commented Apr 3, 2020

Ok i understand , and i have not seen empty implementation
Thx

@relu91
Copy link
Member

relu91 commented Apr 22, 2020

We are also using the workaround that @egekorkan suggested above. Are there any plans to define an algorithm for choosing one form over the other? I think is essential to start a discussion about this point.
For starting, a simple fall back mechanisms could be implemented (thanks to @hyperloris and @lukesmolo for the nice discussion about it).

In pseudo-code:

if cachedClient != null :
    return client.performAffordance(affordance)

for each form in forms:
    client = getClientForForm(form)
    result = client.performAffordance(affordance)
    if( result != error):
       cachedClient = client
       break;

return result

@danielpeintner
Copy link
Member

We are also using the workaround that @egekorkan suggested above. Are there any plans to define an algorithm for choosing one form over the other?

The scripting API will shortly provide an option which can be passed along with each interaction request to specify the formIndex that a client wants to use.
Note: this is an optional option.

@relu91
Copy link
Member

relu91 commented Apr 22, 2020

Nice! 🥳 but since it is optional I would like to have a default behavior like the one presented above.

@danielpeintner
Copy link
Member

formIndex option is defined in the scripting API and implemented by node-wot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants