-
Notifications
You must be signed in to change notification settings - Fork 3
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
Proposal: Split operation
and messageType
into separate members of a message
#42
Comments
operation
and messageType
into separate members of a messageoperation
and messageType
into separate members of a message
Ooh sorry, I must have overlooking this somehow. In short: "I love it!" This addresses almost all issues I ran into in my experiments with strawman. It also easily supports expansion of operarations if there is such a need. A few minor thoughts (not a big deal):
ps: I did eventually implement the strawman proposal in hiveot in addition to the second proposal I raised elsewhere. It is working but it was not a happy implementation and took 500 lines of golang extra. The above is so much better. pps: Maybe the MQTT binding can adopt the same messaging. It too is an asysnc request/response protocol after all. |
@hspaay wrote:
I don't think waiting 5 seconds for a response to a writeproperty operation is necessarily a problem over a WebSocket. In general though if an operation takes a very long period of time and you need to monitor its progress, I would suggest using an action rather than a property. I would rather not introduce the concept of the status of a property read/write since this doesn't exist in the WoT information model. At least with actions there is the concept of querying the status of an action, even if it is poorly defined. One option with sleeping devices could be to just respond without a value to acknowledge that the request has been received but not report that it has been acted upon (same as with write-only properties). A Consumer could then either read or observe the property if it wants to be updated when the change in value takes effect.
Yes.
Personally I prefer a "name" and "value" pair for properties, where a "value" can be both an input to the operation (in the case of writing a property) and an output from the operation (in the case of reading a property). The differentiation from actions (and events) is intentional, because the terms "input" and "output" have special meanings in actions with their own dedicated data schemas in the Thing Description. |
Thank you for elaborating Ben |
I responded to action messages in #43. In short I think an ActionStatus object is needed based on my experience in hiveot. More details in the linked issue. |
On un unrelated note, it is curious to see that this proposal has the number 42 |
This proposal builds on @hspaay's message envelope proposal in #34 (and #32), and @RobWin's suggestion for acknowledgements of certain messages (e.g. #29).
It is a further exploration of the idea of splitting
operation
andmessageType
into separate members of a message, whereoperation
is anop
name taken directly from the Thing Description specification andmessageType
is one of three basic types: request, response and notification.I've kept response and notification separate as per @hspaay's original proposal because I do think the two are meaningfully different, though I still feel a bit uneasy about this because "notification" is not a clearly defined concept in existing WoT specifications. It also kind of mixes up the common request/response and publish/subscribe design patterns.
Although I have adopted the proposal of a consistent "name" member to contain the name of the affordance the message relates to, one way this proposal differs from @hspaay's proposal is that it keeps separate members for different data payloads depending on the type of operation, rather try to combine everything into
input
andoutput
. This is intended to make the mapping of data schemas from a Thing Description more obvious and not have members with the same name but different meanings:input
andoutput
data schemas in ActionAffordances) and a "status" (consistent with the HTTP Basic Profile)data
member in EventAffordances)Another way that this proposal differs is that there are never multiple responses to a request, only multiple notifications and a single response. This is achieved by property observations and event subscriptions having a request, response then notifications, and action invocations having a request, notifications then a single response.
Message Types
Operations
readproperty
writeproperty
observeproperty
unobserveproperty
readallproperties
writeallproperties
readmultipleproperties
writemultipleproperties
observeallproperties
unobserveallproperties
invokeaction
queryaction
queryallactions
subscribeevent
unsubscribeevent
subscribeallevents
unsubscribeallevents
* I'm a bit uneasy about the lifecycle of the invokeaction operation because we have kind of invented a combined invokeaction/observeaction operation, which doesn't exist in the Thing Description specification. There is currently no way to specify the data schema of an action status and no way to observe the status of a property in the the TD spec.
Examples
readproperty
Request
Success Response
Error Response
writeproperty
Request
Response
Note: To address the issue raised in #38 about non-confirmable writes, a value could only be provided in a response if it is confirmed to have been written.
observeproperty
Request
Response
Notification
unobserveproperty
Request
Response
readallproperties
Request
Response
readmultipleproperties
Request
Response
invokeaction
Request
Notification
Response
queryaction
Request
Response
queryallactions
Request
Response
subscribeevent
Request
Response
Notification
I don't have a complete set of examples yet and there are still some questions that I think would need answering, but I wanted to see what people thought.
Notes:
error
message type, since the error would be contained in a response.ping
andpong
messages from the strawman proposal also don't fit neatly into this approach, though I'm not completely sure they're needed.correlationID
s should work inqueryaction
andqueryallactions
messages, but I will file a separate issue for that.The text was updated successfully, but these errors were encountered: