Search code examples
javascriptbonjourzeroconf

Bonjour Discovery in Javascript? Maybe?


So its a longshot, I'll start with that.

Is it/could it be possible to discover bonjour advertised HTTP services in javascript alone?

Why would this be useful? Imagine a local service looking after some data (eg your current lat/long), the data is exposed via a webservice and advertised by Bonjour Zeroconf. A (remote) website might want to know your current lat/long and rather than having to know you're running MyGPSserverVersion2 the site could use javascript to search the local bonjour for _Compatible_location_services._tcp and then continue once it had an IP address.

If this is impossible (I think its probably the case, Javascript is fairly restricted) then what are the hurdles and does anyone have any ideas as to how to overcome them?


Solution

  • This seems to be possible using the Chrome's Sockets API, but I've only taken a cursory look.

    mdns-browser seems to implement this using said APIs.