-
Notifications
You must be signed in to change notification settings - Fork 81
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
ProtocolClient Interface does not allow to specify the affordance name, if the information is not contained in the Form #1342
Comments
It seems that the Having said that, I wonder what is the best way forward with the following aspects in mind:
Any opinions? |
In kotlin-wot I modified
Thus I didn't have to modify existing bindings, but can override this new method in the WebsocketProtocolClient. But Typescript cannot have default implementations in interfaces or? But I agree a single |
In dart_wot, I actually had a similar problem and solved it (for now) using an additional |
Indeed, we need an object (or AugmentedForm), because the |
@relu91 do you have additional opinions? I kind of like the proposal from @JKRhb to hand over an augmented form. |
TL;DR: Forms are the source of truth for protocol bindings. Extending Apologies for the delayed response! Here's a summary of today's discussion during the committers' call: In node-wot (and WoT), we emphasize a clear separation between protocol-specific logic (protocol realm) and application-dependent concerns. During the call, we agreed that forms should serve as the definitive source of truth for protocol bindings. They must include all the necessary information to construct requests. Extending the We’re still interested in hearing from @JKRhb about the specific need for passing additional context information to the protocol interface. Regarding the WebThing protocol, it should have its own dedicated protocol binding (which we can incubate) to define how property names or other affordance identifiers should be expressed. This approach would also allow affordance names to differ from protocol-level identifiers. To address verbosity, we discussed implementing a default fill preprocessing step at the consume time in |
I'm not sure I understand you correctly. There are protocols where the current form schema and href might not be sufficient to describe everything needed for communication. Do you mean that a protocol binding can extend the form by adding protocol-specific extensions at runtime, but not in the Thing Description itself, correct? |
Let's try with a possible example. In theory, we should have a protocol binding document for Webthing protocol. Let's assume that in there they define that to describe the configuration in forms you must use {
"href": "https://websocket.endpoint"
"wtv:affordanceName": "propertyA"
} If people are ok with this we don't have to do anything as the Form instance contains all the information needed. However, one of the most common complains for ThingDescriptions is that it is too verbose. Therefore, the protocol binding document could say that To support this default filling we can preprocess the TD and ask the protocol binding implementation (which knows the defaults rules) to fill the missing fields. I know that in the end the result is that the protocol binding would need to access application level information, but at least we separate the concerns and make clear that the form is the only source when processing a WoT operation request. |
To make it a bit more practical ... which might help to understand what we propose to do for node-wot (and maybe other implementation can do the same?). Our assumption is that handing in a form for a read request should be sufficient (just like we do today in https://github.com/eclipse-thingweb/node-wot/blob/d534535d68d2583a04e5d930a9aeba28e94cef14/packages/core/src/protocol-interfaces.ts#L50C18-L50C28). If a given protocol needs additional information (such as the name or any other information) it can be added in a protocol-specific pre-processing step. This step is protocol dependent and might even be a void operation in most of the cases. @RobWin let's get back to the example you raised about the need to know the interaction name. We plan to extend
node-wot will go over the forms and pass it to the according protocol implementation and ask each binding to add additional information (if needed). As said, in most of the cases it will be a no-op. In the case where the name is needed, you can add this information to the form. A subsequent I hope this explains a bit our current thinking. Does this make sense? EDIT: As a side-node. We do already something similar with relative hrefs. At the moment, node-wot updates each form from a relative URL to an absolute URL. Otherwise, we would need to hand in |
I now finally found the time to revisit my implementation and the reason I added the A more important aspect in practice, though, is the exposure of |
The implementation of the ProtocolClient methods in node-wot assume that all the information needed to read a property, invoke an action or subscribe to an event is contained in a Form. See https://github.com/eclipse-thingweb/node-wot/blob/master/packages/core/src/protocol-interfaces.ts#L48
When implementing a websocket binding based on the Webthingprotocol, we saw that this is not the case for all protocols.
We had a long discussion on Discord about it. And in the Webthingprotocol spec the form href will not contain a property name or action name, so we would need to overload ProtocolClient methods with additional versions which also take the names as an input parameter.
The text was updated successfully, but these errors were encountered: