-
Notifications
You must be signed in to change notification settings - Fork 17
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
Directories should notify subscribers when a TD is updated #28
Comments
There should also be a mechanism to keep this information for disconnected or late subscribers. For example, MQTT has persistent sessions and retained messages concepts, but relying on a broker adds additional complexity such as the broker access control. A request-response alternative could be to redirect authorized users from the old resource location to the new one (e.g. HTTP 301 redirect). Off topic: Need to define a RESTful interaction for changing the ID. |
I just want to mention that directories might have also the capability to notify subscribers if something related to one query changes. For example, discovery clients might subscribe not to a set of prefixed events (i.e. select ?td where {
?td rdf:type wot:Thing;
rdf:type sosa:Sensor;
.....
} Consequently, the directory might also implement a query-based subscription protocol. So we could still need this notification mechanism even if we end up with static TDs. We had some experiments last year. You can find a toy implementation of a Thing Directory capable of handling this notification mechanism here (it is quite outdated but I can revamp a little bit before the next meeting) and, as a reference, it was used as a Thing Directory service inside of our WoT Store implementation (See here). |
IMHO some directories might support TD updates, others may not need to. I am leaning towards letting directories be more like applications, described by TDs, as it leaves most room for versatility. |
+1. If a directory is described by a TD, there could be an event which is emitted to notify clients when a TD has been updated. This event could have any name, but use a semantic annotation which marks it as a
|
To summarize, the (optional) directory notification API must allow subscription to three event types for TDs (i.e. created, updated, deleted). Moreover, the API may support server-side filtering of events using SPARQL queries. What should be inside an event payload? |
I agree the minimum should be I would not totally discard the diff option. It might be useful to save some network bandwidth. What if we make it an optional field in the event payload? clients might ignore it but who can apply the diff can spare the next API call to get the updated TD. TDDs might also decide not to implement it since it is optional. |
In #133 we discussed how the current draft combines the created, updated and deleted events into a single event. I propose in that issue that these should be three separate events. I have also proposed new Edit: I should mention that if they are not three separate events, it's not possible for a consumer to subscribe/unsubscribe to/from only a single event if desired. |
I think adding a fourth subscribe-all endpoint adds complexity without replacing all the current functionality. As mentioned before, the current combination allows subscription to one, multiple (currently two), or all. A new I'll summarize my concerns:
Beyond SSE: The subscription control (one/multiple/all) with query arguments also applies to WebSockets. In MQTT, one can either subscribe to multiple using fixed topics Please see my counterproposal: #133 (comment) |
Maybe this is a matter of taste, but it seems a lot simpler to me than a mess of URI variables. I would be fine with
This seems like an argument for separating them?
This argument could apply equally to both
Sure, but WebSockets requires a separate endpoint in its own form because it uses a different protocol scheme. WebSockets also requires defining a sub-protocol since it has no inherent semantics of its own. E.g. in WebThings we use a single WebSocket endpoint per thing in a top level form which supports all operations:
See w3c/wot-thing-description#1070 But let's try to keep the discussion to the current HTTP-based API with SSE. |
Passing multiple values to a single query argument is not standardized, but widely accepted as Some examples: Python 3.9.2 (default, Feb 24 2021, 13:30:36)
>>> from urllib.parse import urlparse, parse_qs
>>> u = urlparse('https://tdd.example.com/events?type=created_td&type=deleted_td')
>>> parse_qs(u.query)
{'type': ['created_td', 'deleted_td']}
I wasn't trying to argue for the separation. But rather just explaining that connection overheads which would result from decoupling the event endpoints can be solved over HTTP/2. In other words, decoupling does not make it worse for directories serving HTTP/2 clients.
Yes, it also applies to multiple events. |
Resolution: This capability is now included in the specification. There is one subpart which is open but it is linked above: issue #176. So we can close this issue and deal with the last point under that issue. |
I am not exactly sure how this is fixed in the current specification. How can I subscribe to the |
@egekorkan please refer to the the Event Filtering section of the working draft which explains how a client can pass one or more TD IDs as query parameters to perform server-side filtering. Edit: I think it makes sense to add that filtering by ID back. (Sorry for changing my comment few times. I got confused by looking at different versions of the draft.) |
I think that the version in the Working Draft is good enough for the id filtering and I would like to see it reintroduced as well :) |
From Discovery call:
|
Directories should support a capability to notify a subscriber if a TD changes.
Such changes can include rotation of IDs in order to discourage tracking and enhance privacy (only authorized subscribers would get the new ID).
The text was updated successfully, but these errors were encountered: