I am using GCDWebServer and starting it by running:
webServer!.start(withPort: 8080, bonjourName: "Test")
When checking the [INFO]
logs from GCDWebServer, I can see two messages in two distinct spots:
- GCDWebServer started on port 8080 and reachable at http://{deviceIp}:8080/
- GCDWebServer now locally reachable at http://{deviceName}.local:8080
I am consufed by the fact that the other URL uses the device name and not the bonjourName
I configured in the code above, but it's not a big deal.
What is a bigger deal is that after implementing the GCDWebServerDelegate
's webServerDidStart
, printing serverURL
from there still shows the IP URL.
I can also see that webServerDidStart
is invoked before I get the Bonjour registration complete for GCDWebServer message in the log.
How can I get the human-readable URL?
The property to use is
bonjourServerURL
.serverURL
is always the IP address and oncewebServerDidCompleteBonjourRegistration
delegate method is called,bonjourServerURL
holds the value. I don't know why the host name in the Bonjour URL doesn't match thebonjourName
argument value.