Is it possible to open a Location directly, without multicast discovery?
tv42 opened this issue · 2 comments
tv42 commented
It seems to take about 2.2 seconds to go through the discovery process, here. Could I store a Location after a successful discovery, and just open it directly on subsequent runs? I don't quite see how that'd be done with the apis, DiscoverDevices seems to do some xml fetching and parsing that isn't exposed separately.
tv42 commented
Copy-pasting requestXml and doing
root := new(goupnp.RootDevice)
u, err := url.Parse(loc)
if err != nil {
log.Fatalf("url parsing: %v", err)
}
if err := requestXml(u.String(), goupnp.DeviceXMLNamespace, root); err != nil {
log.Fatal("fetching metadata: %v", err)
}
root.SetURLBase(u)
drops the time from 2.2 seconds to 0.05s. It would be very good to have this in a supported method.
huin commented
Thanks for the report. Let me know if this doesn't meet your needs.
I'll try to follow up with another change to support similar functionality in dcps packages.