windy1 / zeroconf-rs

zeroconf is a cross-platform library that wraps underlying ZeroConf/mDNS implementations such as Bonjour or Avahi, providing an easy and idiomatic way to both register and browse services.
MIT License
77 stars 25 forks source link

Service subtypes do not appear to be registered correctly #30

Closed ssnover closed 1 year ago

ssnover commented 1 year ago

I'm trying to register and publish a service with subtypes like _matterc._udp,_S0,_L250.

When I try to do so, I get an error indicating that the service type is invalid:

[2023-09-11T19:49:02Z DEBUG zeroconf::linux::service] Registering service: AvahiMdnsService { client: None, poll: None, context: AvahiServiceContext { name: None, kind: "_matterc._udp,_L250,_S0", port: 5540, group: None } }
[2023-09-11T19:49:02Z DEBUG zeroconf::linux::service] Creating group
[2023-09-11T19:49:02Z DEBUG zeroconf::linux::service] Adding service
[2023-09-11T19:49:02Z ERROR rs_matter::mdns::zeroconf] Encountered error registering mDNS service: could not register service: `Invalid service type`

It looks like the library attempts to register the service as a single service type with avahi_entry_group_add_service, but in order to register subtypes, they need to be registered with avahi_entry_group_add_service_subtype. There's an example in the avahi documentation: https://www.avahi.org/doxygen/html/client-publish-service_8c-example.html

windy1 commented 1 year ago

Resolved by #32