Re: [hybi] [whatwg] WebSockets: UDP

Mark Frohnmayer <> Thu, 10 June 2010 22:22 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id A46AE3A6813 for <>; Thu, 10 Jun 2010 15:22:05 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: 0.901
X-Spam-Status: No, score=0.901 tagged_above=-999 required=5 tests=[BAYES_50=0.001, J_CHICKENPOX_33=0.6, MIME_8BIT_HEADER=0.3]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id uDky+nJx-mhv for <>; Thu, 10 Jun 2010 15:22:03 -0700 (PDT)
Received: from ( []) by (Postfix) with ESMTP id 2E7FB3A6818 for <>; Thu, 10 Jun 2010 15:22:03 -0700 (PDT)
Received: by gxk8 with SMTP id 8so54113gxk.31 for <>; Thu, 10 Jun 2010 15:22:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=sTHpPYhcnDU7+TT5uSUSt9RitQQizACGUWAyqxc8hP4=; b=lLxqJtnBPYZP6+4A4N+/8q+vi36Ag1KV2uTGdqlYTgSEqYUE1kePnSWGBXbcjZvrS8 siw1IPflnC+tWNPP3O4zccBdKlFh4lIDTqBwp996D7U3m2MJga7hmw4tmrbXgPNfkSAK Dr/vl++4pgUYZlbRFoVx/TxKNRIY37hNJVSgk=
DomainKey-Signature: a=rsa-sha1; c=nofws;; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=BSI64kcfVanNVRnoHNQSJq1r0jJDg6XgSrpEYVUzn/G3psmn3TpjmD1djxyYKK75Fk v/4ndlaBUH58BpQ0gahR0x8m72jnXLSe6Cr0DGFt8J+a8mbkKBGw6oVq1NLs2tvIRkCB LBGuB7w2Ss6h2pmVVy2mC6zZHjS7Pibsi7BuA=
Received: by with SMTP id h14mr767154ano.206.1276208520054; Thu, 10 Jun 2010 15:22:00 -0700 (PDT)
MIME-Version: 1.0
Received: by with HTTP; Thu, 10 Jun 2010 15:21:38 -0700 (PDT)
In-Reply-To: <op.vd3ndpzqr4mipi@emoller-pc.gothenburg.osa>
References: <op.vdl9bszhr4mipi@emoller-pc.gothenburg.osa> <> <op.vdmg3ov6r4mipi@emoller-pc.gothenburg.osa> <> <op.vdm0lrqmr4mipi@emoller-pc.gothenburg.osa> <> <op.vdpn931pr4mipi@emoller-pc.gothenburg.osa> <op.vd3ndpzqr4mipi@emoller-pc.gothenburg.osa>
From: Mark Frohnmayer <>
Date: Thu, 10 Jun 2010 15:21:38 -0700
Message-ID: <>
To: Erik Möller <>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Cc: "" <>, Hybi <>, Philip Taylor <>
Subject: Re: [hybi] [whatwg] WebSockets: UDP
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Thu, 10 Jun 2010 22:22:06 -0000

On Thu, Jun 10, 2010 at 12:35 PM, Erik Möller <> wrote:
> Regarding the discussions on at what level the API of a UDP-WebSocket should
> be: One of the most important aspects to remember are that for this to be
> interesting to application developers we need all the browser vendors to
> support this feature in a compatible way. Therefore it doesn't seem
> reasonable to standardize and spec a higher level network API akin to RakNet
> / Torque Socket and hope all vendors will be willing to spend the (quite
> large amount of) resources required for their own implementation of TCP over
> UDP, bandwidth throttling etc. In our opinion we're much better off
> standardizing a minimal UDP-like socket. For most application developers it

TorqueSocket is not in the same category as RakNet or OpenTNL -- the
point of the TorqueSocket effort was to find the web equivalent of a
minimal UDP'ish socket (understanding of course that it would be in
the context of a connected packet stream).  RakNet and OpenTNL provide
higher level data guarantees, RPC, object state replication, etc.
TorqueSocket is a simple send/recv packet protocol - it does no TCP
over UDP or bandwidth throttling.

> As discussed the following features/limitations are suggested:
> -Same API as WebSockets with the possible addition of an attribute that
> allows the application developer to find the path MTU of a connected socket.
> -Max allowed send size is 65,507 bytes.

I'd recommend doing some real-world testing for max packet size.  Back
when the original QuakeWorld came out it started by sending a large
connect packet (could be ~8K) and a good number of routers would just
drop those packets unconditionally.  The solution (iirc) was to keep
all packet sends below the Ethernet max of 1500 bytes.  I haven't
verified this lately to see if that's still the case, but it seems
real-world functionality should be considered.

> Some additional points that were suggested on this list were:
> -Key exchange and encryption
>  If you do want to have key exchange and encryption you really shouldn't
> reinvent the wheel but rather use a secure WebSocket connection in addition
> to the UDP-WebSocket. Adding key exchange and encryption to the
> UDP-WebSocket is discouraged.

If WebSocket supports an encrypted and unencrypted mode, why would the
real-time version not support data security and integrity?

> -Client puzzles to reduce connection depletion/CPU depletion attacks to the
> handshake.
>  If the goal is to prevent DOS attacks on the accepting server this seems
> futile. Client puzzles only raises the bar ever so slightly for an attacker
> so this is also discouraged.

Client puzzles allow the host to allocate zero resources for a pending
connection until it knows that the source address of the client
request is valid and that the client has done some work; you could
still take a similar (though not client computationally expensive)
approach by having the host hash the client identity (IP/port) with a
server-generated secret.  Any approach that allocates memory or does
work on the host without verifying the client source address first is
vulnerable to a super-trivial DOS attack (connection depletion before
even any bandwidth overwhelm).

> -Packet delivery notification to be a part of the API.
>  Again this is believed to be better left outside the UDP-WebSockets spec
> and implemented in javascript if the application developer requires it.

I'd propose that doing this in the javascript level would result in
unnecessary extra overhead (sequence numbering, acknowledgements) that
could easily be a part of the underlying protocol.  Having implemented
multiple iterations of a high-level networking API, the notification
function is a critical, low-overhead tool for making effective
higher-level data guarantees possible.