sd01 is a minimal service discovery protocol with strict implementation.
Development status: Beta. Suitable for production but test coverage needs to be improved.
sd01 is an alternative to mDNS which is implemented by Bonjour/Ahahi.
Current:
Planned:
sd01 reveals the host (IP) and port for any similar services running.
sd01 works by sending a message specific to the service name and service port over a UDP broadcast, port 17823. As a UDP broadcast is used, only hosts on the same subnet can discover. The service host (IP) is taken from the UDP packet source attribute.
An IPv6 and/or IPv4 multicast extension is being considered for version 2.
There are many service discovery systems out there, most of them are much more complicated than normally required. Many systems implement a custom UDP broadcast; sd01 is just a standard way to do so, cross-platform.
sd01 is deliberately minimal. It just exposes the IP address and the port of a particular named service. Note that device descriptions, names, versioning and capabilities are deliberately left out; this should be implemented as an API on the service itself.
sd01 works nicely with an RPC mechanism such as gRPC.
A host emits a sd01 message every 10 seconds. If an announcer has not seen the sd01 message for 600 seconds, the host is considered non-existent.
sd01:[service_name]:[service_port]
Where, without brackets:
sd01
For example with a service name "DS Light controller" running on port 80:
sd01:DS light controller:80
Both the announcer and discoverer are aware of the service_name
in advance.
sd01.py
is the reference implementation. Other implementations are expected
to follow the same design which consists of:
Discoverer.get_services
, a thread-safe method to return online
(host,port) pairs.This sensor is stateless and should just work.
DS Multisensor
port 80
192.168.59.32:80
, and knows the sensor speaks a specific HTTP JSON protocol{
"id": "2ef8787",
"temperature": 49,
"humidity": 23
}
Kitchen
Note that the sensor is effectively stateless. It has its own preconfigured ID, which happens to be derrived from its MAC address.