discovery.js |
This implements a UDP mulitcast device discovery protocol that:
* Is optimized for mobile devices
* Doesn't require any special schema for service info
To ensure it works well on mobile devices, there is no heartbeat or other
recurring transmission.
Devices are typically in one of two groups: scanning for services or
providing services (though they may be in both groups as well).
Scanning devices listen on UPDATE_PORT for UDP multicast traffic. When the
scanning device wants to force an update of the services available, it sends
a status packet to SCAN_PORT.
Service provider devices listen on SCAN_PORT for any packets from scanning
devices. If one is recevied, the provider device sends a status packet
(listing the services it offers) to UPDATE_PORT.
Scanning devices purge any previously known devices after REPLY_TIMEOUT ms
from that start of a scan if no reply is received during the most recent
scan.
When a service is registered, is supplies a regular object with any details
about itself (a port number, for example) in a service-defined format, which
is then available to scanning devices.
|
12328 |
moz.build |
|
390 |
tests |
|
|