demo · v144

Multicast Receiver

Configure a multicast group and watch the page attempt to open a UDPSocket. Outside an Isolated Web App the call fails — the page then runs a simulated mDNS listener so you can see what the read stream would surface.

Direct Sockets / UDPSocket multicast is restricted to Isolated Web Apps. Outside an IWA the API isn't exposed; the demo will fall through to a simulated mDNS responder so you can still see the shape.
UDPSocket present: checking…
no activity

the API

const sock = new UDPSocket({
  remoteAddress: "224.0.0.251",
  remotePort: 5353,
  multicast: { interfaces: ["wlan0"], ttl: 1 },
});
await sock.opened;
const reader = sock.readable.getReader();
while (true) {
  const { value, done } = await reader.read();
  if (done) break;
  console.log(value.remoteAddress, value.data);
}

see also