Skip to content

Simplify discovery methods #311

@zolkis

Description

@zolkis

Right now, supported DiscoveryMethod strings are any, directory, local, multicast. In earlier drafts we also had direct, and #222 considers that use case as well.

I'd like to propose removing local and multicast, and re-add direct, with any remaining redundant (removed as well).
So in the end we'd have support for direct and directory methods.

We had a call with @relu91 about this and we agreed about the following.

Reasons to remove local:

  • It would be very complex to define what exactly it would mean. It could mean sensors/actuators available on the same HW or SW or WoT runtime. Examples: local accelerometer, various thermometers, gyroscope, proximity, ambient light sensor etc, in general covered by the Generic Sensor API suite. Or NFC adapter, or things locally connected via Bluetooth, etc.
  • It would be complex to implement. How a WoT implementation would find all these and how does it expose them as Things?
  • This functionality should better be implemented in SW package(s) that need to implement a subset of the locally available sensors and also add Thing Descriptions and (or expose via) a local Thing Directory.
  • The Scripting app, and implementation could then find and integrate a local Thing Directory given its URL.

Reasons to remove multicast:

  • There is some confusion what does it exactly cover. Multicast discovery is usually used in phase 1 discovery (provisioning time), but in some protocol suites also in operational mode. It is unclear what an implementation should do when receiving multicast from an application. Right now the spec is too vague about this: "discovering Things in the device's network by using a supported multicast protocol." It sounds like "discover anything, but with a multicast method". Which leads to the next argument:
  • So far we don't have a strong use case for supporting it. Therefore we can test to remove it and re-add later when there is a use case for it.

Reasons to re-add direct:

  • We have a use case for it in many protocol suites. If an app provides a URL, that is pointing to a Thing Directory, it might provide different things in direct mode (e.g. the TD of the directory itself) vs all the TDs contained in the directory (if directory was provided as method).
  • Provides an more convenient WoT-specific way to fetch a TD from a URL (as opposed to using the Fetch API).

Counter-arguments to re-add direct:

  • Since discovery in Scripting currently returns TDs, it would be the same as fetching a TD from a URL. Although in the simple cases it would be more convenient for apps to use discovery vs Fetch.
  • Using discovery for a "convenient fetch" sounds a bit awkward.

Reasons to remove any:

  • It is not needed any more. The app has to know if it wants a TD from a URL, or if wants to get TDs from a directory. The directory method could be the default, as the direct method is more specific and it's better visible in the code explicitly.

Please chime in with opinions. I can provide a PR after the discussion settled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions