demo · v142

Service Discovery (mDNS-style)

The scenario that drove the IWA spec authors to add multicast: peer service discovery without a central rendezvous server. An Isolated Web App joins the well-known group 224.0.0.251:5353 (the mDNS address), broadcasts a query, and any matching service on the LAN replies. The simulation below runs that exchange in the browser tab; the real UDPSocket with multicastInterface only works inside an installed IWA on Chrome 142+.

Real multicast UDPSocket is gated to Isolated Web Apps. Try the constructor below — outside an IWA it throws. Inside an IWA on Chrome 142+, the socket binds and joins the group.

this peer

browser tab
joined 224.0.0.251:5353

LAN — replies

DirectSockets / UDPSocket exposed
discovered services
0

The multicast extension to Direct Sockets is the difference between "the IWA can talk to one known IP" and "the IWA can find peers without preconfiguration" — a precondition for any LAN-only collaborative app (printing, casting, gaming, AV switchers).

relevant API

// only valid inside an Isolated Web App
const sock = new UDPSocket({
  remoteAddress: "224.0.0.251",
  remotePort: 5353,
  multicastInterface: "0.0.0.0",
  multicastTimeToLive: 1,
  loopback: false,
});
const { writable, readable } = await sock.opened;
await writable.getWriter().write(encoded_mdns_query);

see also