WebThingsIO / api

Web Thing API Specification
http://iot.mozilla.org/wot/
Other
164 stars 25 forks source link

Add a discovery section. #152

Closed mrstegeman closed 4 years ago

mrstegeman commented 4 years ago

Fixes #75

mrstegeman commented 4 years ago

@benfrancis please critique.

mrstegeman commented 4 years ago

Well, we’ve only ever supported HTTP(S), so that’s just always been assumed. However, CoAP is UDP, so for that, we could instead use _webthing._udp.

benfrancis commented 4 years ago

CoAP is UDP, so for that, we could instead use _webthing._udp.

That's fortunate :)

Actually, I've just re-read the discussions in https://github.com/mozilla-iot/wot/issues/75 and https://github.com/mozilla-iot/gateway/issues/696 where it looks I suggested exactly that! I now remember the discussion about sub-types and the discussion about what the service type should be.

Just to complicate matters I've noticed text in the DNS-SD service types documentation says:

Content types not intended primarily for viewing by a human user, or not widely-supported in web browsing clients, should not be advertised as DNS-SD service type "http", even if they do happen to be transported over HTTP. Such types should be advertised as their own logical service type with their own DNS-SD service type, for example, XUL (XML User Interface Language) transported over HTTP is advertised explicitly as DNS-SD service type "xul-http".

So another option would be webthing-http.

I think this is fine to land as-is as _webthing._tcp is totally valid and is documenting what is already implemented. I do anticipate there might be more questions about this if we try to standardise it though.

mrstegeman commented 4 years ago

We used to use sub-types but ran into issues with those being unsupported by various libraries. See here.

Technically, the Web Thing add-on still supports that scheme, but we don't use it in any of our webthing libraries anymore.

benfrancis commented 4 years ago

We used to use sub-types but ran into issues with those being unsupported by various libraries. See here.

Oh wow, I'd not seen that discussion. Very interesting.