On Mon, 03 May 2010 23:59:19 +0200, Mark Frohnmayer
<[email protected]> wrote:
Hey all,
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 4.11.6.2
(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
relevant.
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
here:
http://github.com/nardo/torque_sockets/raw/master/TorqueSocket_API.txt
now actually functions in the form of an NPAPI plugin. I recorded a
capture of the javascript test program here:
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 :).
Cheers,
Mark
I'm an old gamedev recently turned browserdev so this is of particular
interest to me, especially as I'm currently working on WebSockets.
WebSockets is a nice step towards multiplayer games in browsers and will
be even better once binary frames are speced out but as Mark says
(depending on the nature of the game) gamedevs are most likely going to
want to make their own UDP based protocol (in client-server models as
well). Has there been any discussions on how this would fit under
WebSockets?
Opera Unite can be mentioned as an interesting side note, it does peer
introduction as well as subnet peer detection, but again that's TCP only.
--
Erik Möller
Core Developer
Opera Software