Device Discovery Using Network Service Discovery (NSD)
Network Service Discovery (NSD) is a technology that enables devices to discover services on a local network without requiring manual configuration. It is part of the broader Zero Configuration Networking (ZeroConf) suite, designed to simplify network service configuration.
Relation to Bonjour and ZeroConf
- ZeroConf: A set of technologies that facilitate automatic configuration of network services without user intervention. It includes components like address assignment, name resolution, and service discovery.
- Bonjour: Apple's implementation of ZeroConf, widely used for service discovery in macOS and iOS environments. It uses the multicast DNS (mDNS) protocol to advertise and resolve service information.
- NSD in Synqpay: Synqpay implements service discovery via mDNS, compatible with tools and libraries like Bonjour and Python's
zeroconfpackage.
Using NSD, Synqpay devices advertise their API endpoints, enabling client applications to discover and connect without requiring IP addresses or URLs to be preconfigured.
NSD Implementation in Synqpay Devices
- Service Name: The device's serial number.
- Service Type:
_synqpay._tcp(for all supported transport layers). - Service Properties:
transport: Specifies the transport layer used by the device API.wsfor WebSocket.tcpfor TCP.httpfor HTTP.
-
name: The device name, as configured in the Device Management System (DMS). -
Enabling NSD:
NSD functionality must be enabled in the device settings screen for the device to advertise its presence.
Code Example: Discovering Synqpay Devices
Below is an example using the Python zeroconf library to discover Synqpay devices advertising the _synqpay._tcp.local. service:
Result
Setup
- Install the
zeroconf(link) package via pip: - Run the script in a Python environment with network access.