signalk-server
signalk-server copied to clipboard
[WIP] feature: use vessel name as mdns instanceName
https://tools.ietf.org/html/rfc6763#section-4.1.1
For the http service prefix the vessel name with SK. For the SK service types just use the vessel name.
added some comment on #1294
Added retries, but haven't tested this with Avahi yet. Could you please give it a try @wellenvogel ?
I have made some tests with avahi daemon. I guess still not reaching the final goal ;-)
- Whenever avahi-daemon restarts a new suffix will be appended to the name. This will for sure confuse any clients. Basically the standard recommends to always reuse the last name that you registered successfully. In my code I did it with an extremly simple approach - could be done much better of course. If we would like to be as close as possible to the standard we would need to store the last name persistently.
- And if I restart avahi-daemon > MAX_RETRIES ... - the mdns entry will disappear. I guess max retries should only be effective for errors due to name clashes. All the async errors should simply start a re-register without any name change. Maybe this needs a second thought when using the internal mdns implementation. Did not really check this too much.
- Small remark for using the shipname: On one hand side this is cool - but: If you start from scratch you will have the hostname first. And once you change your shipname - the names will (surprisingly?) change... At least I guess this needs some clear documentation.
#1477 introduces the ability to store "serverstate" properties and the mdns naming status could go there.