-
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
How to avoid duplicates in a directory #48
Comments
A use case for valid duplicates is for devices which have event interaction affordances to publish/subscribe to an MQTT broker under the same topic or to call an external webhook endpoint whenever data is available. The TD will be duplicate if it is anonymous (for whatever reason). The system-generated IDs (generated by TDD) may be used to locate the TD or update it. The events produced by these devices may include the ID or have some other identifier. Example 34 without ID: {
"@context": "https://www.w3.org/2019/wot/td/v1",
"title": "MyIlluminanceSensor",
"securityDefinitions": {"nosec_sc": {"scheme": "nosec"}},
"security": ["nosec_sc"],
"events": {
"illuminance": {
"data":{"type": "integer"},
"forms": [
{
"href": "mqtt://192.168.1.187:1883/illuminance",
"contentType" : "text/plain",
"op" : "subscribeevent"
}
]
}
}
}
|
We should note that duplicates can also happen unintentionally when TDs are not anonymous. In a non-WoT context, we had applications which were generating UUIDs at startup time and using them to register themselves into a directory. One application (service) was crashing and restarting continuously, creating a unique registration every time, until it was fixed. In the meantime, it created thousands of unique looking registrations. To avoid such scenarios, we introduced mandatory, short TTL for registrations to eventually cleanup accidental registrations and only keep those that are actively maintained (e.g. with a keep alive mechanism). Note: issue #18 relates to this. |
Regarding the MQTT comment above, in a way, in MQTT case, a TD describes the broker and not really the Thing. |
I propose closing this issue for the following reasons:
|
Discussed July 4, 2022; will close. Resolved (or well, users of the directory are responsible for not using duplicate ids unless they mean to do an update). |
Registration of TDs using non-idempotent HTTP POST method enables creation of anonymous TDs (TDs without
id
attribute). The producer can distinguish between the created TDs using the unique-system generated IDs given in the response Location header.A side-effect of this is that clients will be able to register duplicate TDs accidentally or on purpose.
Need to clarify:
The text was updated successfully, but these errors were encountered: