How do you discover a thing in your own app?

Hi,

I want to make some type of an IoT hub that accepts Web Thing devices.
I’m trying to make the functionality similar to the “plus” button in the WebThing Gateway.
However, my limited knowledge prohibits me from even finding where to start.
It will be grateful if you could guide, at least vaguely, how to discover a Thing like in the WebThing Gateway.

Thanks,
Jun

Hi @junwyoo,

If you haven’t already found it, a good place to start is the Web Thing API specification, which documents the API web things are expected to expose.

A web thing should act as a web server and have a URL which resolves to a Web Thing Description which describes its properties, actions and events. Currently in the gateway you can add a web thing by manually entering the URL of its Thing Description.

You might want to start by writing a parser which can parse a Web Thing Description from its JSON format and a user interface where you can manually enter a web thing URL. Then you could work on generating a UI to interact with a web things properties, actions and events via the Web Thing REST API.

Later you could start to look into listening for mDNS broadcasts (a way of discovering a web thing URL on a local network automatically).

Hope this helps

Ben

Is the gateway somehow modular?
Can he reuse the part where the webthing identified and read?

It sounds like what @junwyoo is doing is building a Web of Things client app. Currently we don’t have one of those to refer to (but we are discussing building a mobile app).

However, the code the gateway uses to proxy web things via the gateway is in the thing-url-adapter, which could provide some inspiration for a Web of Things client.