class

Matter::MDNS::Responder

Inherits Matter::MDNS::ResponderInterface < Reference < Object

mDNS Responder for advertising Matter services

Handles:

  • Service advertisement (announcements)
  • Query responses
  • Using Authority Section for authoritative records

Constants

ANNOUNCEMENT_INTERVAL = 30.seconds
DEFAULT_TTL = 120.seconds
MDNS_IPV4 = Socket::IPAddress.new("224.0.0.251", MDNS_PORT)
MDNS_IPV6 = Socket::IPAddress.new("ff02::fb", MDNS_PORT)
MDNS_PORT = 5353

Constructors

new(port : Int32 = MDNS_PORT, hostname : String = "matter-device.local", ip_addresses : Array(Socket::IPAddress) = [] of Socket::IPAddress)
Source

Instance methods

close

Close responder

Source
commissioning_instance_name

Returns the current commissioning DNS-SD instance name (e.g. DD200C20D25AE5F7._matterc._udp.local) if commissioning is currently being advertised.

Source
hostname
Source
ip_addresses
Source
on_query

Callback for received queries Signature: (query : DNS::Packet, peer_address : Socket::IPAddress) -> Nil

Source
on_query=(on_query : Proc(DNS::Packet, Socket::IPAddress, Nil) | Nil)

Callback for received queries Signature: (query : DNS::Packet, peer_address : Socket::IPAddress) -> Nil

Source
port
Source
respond_to_query(query : DNS::Packet, service_type : ServiceType, instance : String, port : Int32, txt_records : Hash(String, String), hostname : String) : Nil

Respond to a specific query with explicit hostname (SRV target).

Source
respond_to_query(query : DNS::Packet, service_type : ServiceType, instance : String, port : Int32, txt_records : Hash(String, String)) : Nil

Respond to a specific query

Source
send_goodbye(service_type : ServiceType, instance : String) : Nil

Send goodbye announcement (TTL=0) to remove service

Source
socket_ipv4
Source
socket_ipv6
Source
start

Start listening for mDNS queries

Source
stop

Stop listening

Source
stop_commissioning

Stop all commissioning advertisements

Source
stop_operational_advertisement

Stop all operational advertisements

Source
update_commissioning_hostname(hostname : String) : Nil

Updates the default commissioning target hostname (SRV target) and re-announces any active commissioning advertisements without changing the commissioning instance name.

Source