[whatwg] Real-time networking in web applications and games
mark.frohnmayer at gmail.com
Mon May 3 14:59:19 PDT 2010
In continuation of the effort to make browsers a home for real-time
peer to peer applications and games without a plugin, I've done a bit
of digging on the spec. Currently the spec contains section 126.96.36.199
(Peer-to-peer connections) that appears to present a high-level
peer-to-peer api with separate functionality for peer connection and
transmission of text, images and streamed data interleaved in some
unspecified protocol. Also referenced from the spec is WebSocket, a
thin-layer protocol presenting what amounts to a simple guaranteed
packet stream between client and server.
For the purposes of discussion there seem to be two distinct issues -
peer introduction, where two clients establish a direct connection via
some trusted third party, and data transmission protocol which could
range from raw UDP to higher-level protocols like XML-RPC over HTTP.
For real-time games, specific concerns include flow control, protocol
overhead and retransmission policy; thus most real-time games
implement custom network protocols atop UDP. Peer introduction is
also important - responsiveness can often be improved and hosting
bandwidth costs reduced by having peers connect directly. For other
p2p apps (chat, etc), specific control of flow and data retransmission
may be less (or not) important, but peer introduction is still
In reading of the current state of the spec's p2p section, it appears
to be poorly suiting to real-time gaming applications, as well as
potentially over-scoped for specific p2p applications. To demonstrate
an alternative approach, the initial prototype of the TorqueSocket
plugin now works (build script for OS X only). The API as spec'd
now actually functions in the form of an NPAPI plugin. I recorded a
http://www.youtube.com/watch?v=HijKc5AwYHM if you want to see it in
action without actually building the example.
This leads me to wonder about (1) the viability of including peer
introduction into WebSocket as an alternative to a high-level peer to
peer interface in the spec, (2) including a lower-level unreliable
protocol mode, either as part or distinct from WebSocket, and (3) who,
if anyone, is currently driving the p2p section of the spec.
Any feedback welcome :).
More information about the whatwg