Closed sarbogast closed 10 months ago
The fact that you encounters an error telling that Bonsoir has failed to resolve a service
with an error code of 0
(which means No error) indicates that you have successfully resolved a service, but Bonsoir cannot find it in its internal list (see implementation details here https://github.com/Skyost/Bonsoir/blob/master/packages/bonsoir_darwin/darwin/Classes/Discovery/BonsoirServiceDiscovery.swift#L167).
It may have to do with parsing your service name.
Indeed, now that I changed the service name from "com.epseelon.bonsoir_test" to just "bonsoirtest", it works. So it seems like it doesn't like the dots. What are the rules for this service name to be valid? And would it be possible to validate it when the service gets created to avoid this exception to be thrown on discovery without even a stacktrace?
What are the rules for this service name to be valid?
Your service name is completely valid (see https://github.com/Skyost/Bonsoir/blob/master/packages/bonsoir_platform_interface/lib/src/service/service.dart#L10). It's a bug in Bonsoir that we need to fix.
It shouldn't be that hard to do, but we have to do some debug in the Swift code.
Describe the bug I created a simple app that either broadcasts an HTTP service or discovers it. If I broadcast on iOS and discover on Android, everything is smooth, the service is found and resolved. If I broadcast on Android and discover on iOS, the service is found but an exception is thrown internally when resolving with very little details.
To Reproduce Steps to reproduce the behavior:
Expected behavior The same log as before, indicating that the service has been resolved
Actual behavior An exception is thrown from within Bonsoir's internal when calling resolve, but doesn't seem to be thrown by resolve itself:
PlatformException(discoveryError, Bonsoir has failed to resolve a service : 0, 0, null)
Smartphone (please complete the following information):
Additional context At first, I tried to just do the discovery without running any actual server on the broadcaster, but then I wasn't really sure of how far the resolver would actually go, so I ran a small shelf websocket server, just like in my real app, but it didn't change anything. I also thought that maybe iOS had a problem with the HTTP server instead of HTTPS, which is why I added
NSAllowsArbitraryLoads:YES
to my iOS configuration, but to no avail. Note that this is a sample project trying to replicate an issue I have in a real project where I don't see any exception but the resolution event is just not received on the discovery side. Did I forget something?