Re: [hybi] Is there a traffic jam?

Paul Prescod <paul@prescod.net> Fri, 24 April 2009 07:12 UTC

Return-Path: <prescod@gmail.com>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 62A983A69FF for <hybi@core3.amsl.com>; Fri, 24 Apr 2009 00:12:29 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.976
X-Spam-Level:
X-Spam-Status: No, score=-1.976 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id C5iG-PMeBFnk for <hybi@core3.amsl.com>; Fri, 24 Apr 2009 00:12:28 -0700 (PDT)
Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.29]) by core3.amsl.com (Postfix) with ESMTP id EAD333A6AF0 for <hybi@ietf.org>; Fri, 24 Apr 2009 00:11:02 -0700 (PDT)
Received: by yw-out-2324.google.com with SMTP id 3so821126ywj.49 for <hybi@ietf.org>; Fri, 24 Apr 2009 00:12:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type; bh=n6h0QbNj2AIob97g6E2I++ix1PTmFPV8GKB852vDfJ8=; b=iSku8cgqHSGAbFxa9mvmqg90PmWyuwoKvcEzyabM9r8mDAt1W26HnwsXJnbYHuN6Lv ji6IJkwJNsZM2efilNYOmqB0wnW7VsUvUXpcEpwdIOxR4Vz3152/gstgOJfSEVkNA+Xh efv95G6CLhqdYjNQtSZMnEg5bY/nwd5rm9faE=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=d8ugygDfIT/Cav0Q0m5Re5mY8R333qFS/CB8GZg30SKCtIlRpLajrOU4O0fI/17BYm KzgOzej5F+U2yQUJIho1TacEm2EPsfPhUXLMG0sL9c1g2UBQCC8hJq/ZETnX1ljPE+5B vuAwwEAGR7+OAGKCVL1pMVeOrQCOj0B+JR1e0=
MIME-Version: 1.0
Sender: prescod@gmail.com
Received: by 10.100.151.8 with SMTP id y8mr2743479and.94.1240557140271; Fri, 24 Apr 2009 00:12:20 -0700 (PDT)
In-Reply-To: <Pine.LNX.4.62.0904240546100.10370@hixie.dreamhostps.com>
References: <03BCE29D-7AA5-4128-9F61-446E0229479A@lindenlab.com> <Pine.LNX.4.62.0904132352430.10339@hixie.dreamhostps.com> <E51D5B15BFDEFD448F90BDD17D41CFF105A0C476@AHQEX1.andrew.com> <Pine.LNX.4.62.0904140002360.10339@hixie.dreamhostps.com> <1cb725390904131712k292a4860pbd078bb251d3855b@mail.gmail.com> <Pine.LNX.4.62.0904140031040.10339@hixie.dreamhostps.com> <1cb725390904131752u5842c039wb3d75602c479fa45@mail.gmail.com> <Pine.LNX.4.62.0904140053050.10339@hixie.dreamhostps.com> <1cb725390904131814o6040a8d3t637069a344d561bd@mail.gmail.com> <Pine.LNX.4.62.0904240546100.10370@hixie.dreamhostps.com>
Date: Fri, 24 Apr 2009 00:12:20 -0700
X-Google-Sender-Auth: 0b8d30f2d736bb63
Message-ID: <1cb725390904240012q781391a1v924cbc1349952499@mail.gmail.com>
From: Paul Prescod <paul@prescod.net>
To: Ian Hickson <ian@hixie.ch>
Content-Type: multipart/alternative; boundary="001485f94562ab64be046847b742"
Cc: hybi@ietf.org
Subject: Re: [hybi] Is there a traffic jam?
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 24 Apr 2009 07:12:29 -0000

A few thoughts:

 1. It boggles my mind that you think that that is the kind of code that
"novices" will write. This is my main point. Everything that follows is of
lesser emphasis.

 2. I do not understand why you wish to inflict this kind of low-level Unix
hacking on novices. Even presuming that they can learn it from "WebSockets
for dummies", they will likely just skip the explanation and type it in as
cargo cult software.

 3. What happens when your tic-tac-toe server gets popular? Does this code
scale?

 4. Proper software engineering would suggest that you should split the
reusable bits from the application logic. Having done this, you will have a
"WebSockets library". At that point, you will never need to worry about 1
through 3 again, and neither will anyone else. But the problem is, once
you've done this, you've undone the very reason that you made the protocol
so simple-seeming in the first place. So you, Ian Hickson probably won't do
that. But someone will do it and no Perl programmer will ever care about the
details of how to parse WebSockets again. On the other hand, when they get
out their trusty TCPDUMP tool, they'll see this crud on the wire:

 0x48,0x54,0x54,0x50,0x2f,0x31,0x2e,0x31,
0x20,0x31,0x30,0x31,0x20,0x57,0x65,0x62,

0x20,0x53,0x6f,0x63,0x6b,0x65,0x74,0x20,
0x50,0x72,0x6f,0x74,0x6f,0x63,0x6f,0x6c,

0x20,0x48,0x61,0x6e,0x64,0x73,0x68,0x61,
0x6b,0x65,0x0d,0x0a,0x55,0x70,0x67,0x72,

0x61,0x64,0x65,0x3a,0x20,0x57,0x65,0x62,
0x53,0x6f,0x63,0x6b,0x65,0x74,0x0d,0x0a,

0x43,0x6f,0x6e,0x6e,0x65,0x63,0x74,0x69,
0x6f,0x6e,0x3a,0x20,0x55,0x70,0x67,0x72,
                                             0x61,0x64,0x65,0x0d,0x0a


In other words, I strongly believe that you are optimizing for the wrong
thing. Slightly easier parsing is not as important as readability of the
protocol, in my opinion. I cannot tell you how many times in a month I do
this:

# telnet localhost 11211
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
stats
STAT pid 2202
STAT uptime 7567475
...

(that's memcached -- but I've never written a memcached client)

# telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
GET / HTTP/1.1
Host: www.slate.com

# telnet localhost 22
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
SSH-2.0-OpenSSH_4.3

Protocol mismatch.
Connection closed by foreign host.

Even SSH at least gives me a readable introductory string to tell me what
protocol is running and that the server is alive and kicking.


On Thu, Apr 23, 2009 at 11:11 PM, Ian Hickson <ian@hixie.ch> wrote:

> On Mon, 13 Apr 2009, Paul Prescod wrote:
> >
> > Please be very specific about HOW a 12-year old who knows PHP would
> > write a multiplayer game using PHP and WebSockets.
>
> I don't know about a 12-year old who knows PHP, but a 12-year old who
> knows, say, Perl, could do it something like this for the server side:
>
>   http://www.damowmow.com/playground/demos/websocket/tic-tac-toe.pl
>
> ...and something like this for the client side:
>
>   http://www.damowmow.com/playground/demos/websocket/tic-tac-toe.html
>
> --
> Ian Hickson               U+1047E                )\._.,--....,'``.    fL
> http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
> Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
>