loge.hixie.ch

Hixie's Natural Log

2005-09-17 11:53 UTC Window of Opportunity

Back in August I tried an experiment: two weeks offline with family and friends in Switzerland. It was awesome. Extremely relaxing and full of that personal growth stuff. Thus, I have decided to give it another try. I'm going to take another two weeks off, mostly Internet-free again, this time on the US East Coast.

Back on the WHATWG spec, the section I'm currently working on is the local network broadcast feature, which would allow applications written as Web pages running on browsers on devices in a LAN or PAN to communicate. This would allow things like party lines, multi-player games, and the like.

For Ethernet networks, I'm leaning towards a UDP-based system. Each packet would consist of the broadcasting page's domain, a colon, and the page data (text encoded as UTF-8) to the broadcast address, on a known port. The domain would then be used to ensure that only Web pages from the same domain could read that data. Well, Web pages and any native applications, of course — we want to allow anyone to write native code that interacts with these pages. (For example, a game server could be written in C++ and run somewhere on the local network, with the game client written in HTML and served from a known network address. Since the server knows the address, it knows what address to put on its headers, and which packets to read from the network when it receives some.)

I'm not sure what size packets to allow; research has suggested that if you want UDP packets to make it through the Internet you might want to limit yourself to 512 byte packets since those are the biggest size that will usually make it through intact (since some routers apparently drop bigger packets rather than fragmenting them, or something). But the idea here is local-network broadcast, not distant unicast, so fragmentation over routers seems irrelevant. That would suggest we could allow up to the full 65507 byte packets (216-1 - 8 (UDP packet header size) - 20 (IPv4 packet header size), or 65487 if we want to be forwards-compatible with IPv6 (IPv6 headers are 20 bytes longer). Then the question becomes "how do we handle transmissions above this limit"? I guess we just raise an exception, but it seems odd to allow US-ASCII users to send more text than people using, say, the plane-1 Shavian alphabet.

Sadly I know very little about those levels of the networking stack, so I'm probably spouting nonsense. If so, don't hesitate to moan at me so I can fix it.

Even worse than not knowing much about Ethernet, though, I don't know anything about Bluetooth and similar standards. I tried reading the Bluetooth spec but its 1230 pages overwhelmed me.

It would be really cool to transparently support things like Bluetooth as well, though. What I want is a way to broadcast to any listening device the name of the broadcasting page's domain, and the data that the page is sending. Anyone know how to specify this?