v144 · network / connectivity
Group Sync Demo
One UDP datagram, received by every device in the group simultaneously. This demo simulates a multicast group of displays synchronizing a shared counter — the canonical "shopping-mall video wall" use case from the Direct Sockets explainer.
Simulated device group
Six displays in a group. When the sender broadcasts, every joined device receives the packet at once.
4
Packet log
Bandwidth comparison
One multicast send vs N unicast sends for the same payload reaching N devices.
Packets sent (multicast)
0
Equivalent unicast packets
0
Bytes saved
0 B
Joined devices
6
Multicast (Direct Sockets v144)
Send once to 224.0.0.251:5353. Every joined device receives it.
0 bytes total
Unicast (legacy approach)
Send a separate UDP packet to each device's IP address.
0 bytes total
Code pattern
// Isolated Web App — send to multicast group
const socket = new UDPSocket({
remoteAddress: "224.0.0.251",
remotePort: 5353,
dnsQueryType: "ipv4",
ttl: 4, // hop limit
loopback: true, // sender also receives
});
const { writable } = await socket.opened;
const writer = writable.getWriter();
// One send reaches every group member simultaneously
await writer.write({
data: new TextEncoder().encode(JSON.stringify({ value: counter })),
remoteAddress: "224.0.0.251",
remotePort: 5353,
});
// Receiver side: join the group
const receiver = new UDPSocket({
localAddress: "0.0.0.0",
localPort: 5353,
dnsQueryType: "ipv4",
ipv4Only: true,
});
await receiver.opened;
// socket.addMembership("224.0.0.251", "0.0.0.0");