Re: [hybi] Ping/Pong body (was Re: TSV-Directorate review of draft-ietf-hybi-thewebsocketprotocol-07)

Jamie Lokier <jamie@shareable.org> Thu, 19 May 2011 23:28 UTC

Return-Path: <jamie@shareable.org>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 71179E06D3 for <hybi@ietfa.amsl.com>; Thu, 19 May 2011 16:28:30 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.599
X-Spam-Level:
X-Spam-Status: No, score=-6.599 tagged_above=-999 required=5 tests=[AWL=-4.000, BAYES_00=-2.599]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Gc8LYCAHfep6 for <hybi@ietfa.amsl.com>; Thu, 19 May 2011 16:28:29 -0700 (PDT)
Received: from mail2.shareable.org (mail2.shareable.org [80.68.89.115]) by ietfa.amsl.com (Postfix) with ESMTP id C7C93E068B for <hybi@ietf.org>; Thu, 19 May 2011 16:28:29 -0700 (PDT)
Received: from jamie by mail2.shareable.org with local (Exim 4.63) (envelope-from <jamie@shareable.org>) id 1QNCdn-0000OP-LG; Fri, 20 May 2011 00:28:27 +0100
Date: Fri, 20 May 2011 00:28:27 +0100
From: Jamie Lokier <jamie@shareable.org>
To: Greg Wilkins <gregw@intalio.com>
Message-ID: <20110519232827.GA969@shareable.org>
References: <ED13A76FCE9E96498B049688227AEA292C6A81E4@TK5EX14MBXC206.redmond.corp.microsoft.com> <F390D8D1-335B-4595-93A2-0741DD693559@gmail.com> <ED13A76FCE9E96498B049688227AEA292C6A85DE@TK5EX14MBXC206.redmond.corp.microsoft.com> <BANLkTimg6Z8rs+SDp-HX+FzJQukKndWqkg@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <BANLkTimg6Z8rs+SDp-HX+FzJQukKndWqkg@mail.gmail.com>
User-Agent: Mutt/1.5.13 (2006-08-11)
Cc: "hybi@ietf.org" <hybi@ietf.org>, Gabriel Montenegro <Gabriel.Montenegro@microsoft.com>
Subject: Re: [hybi] Ping/Pong body (was Re: TSV-Directorate review of draft-ietf-hybi-thewebsocketprotocol-07)
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/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: Thu, 19 May 2011 23:28:30 -0000

Greg Wilkins wrote:
> On 19 May 2011 10:43, Piotr Kulaga <piotrku@microsoft.com> wrote:
> > Personally I do not see any point of allowing multiple outstanding pings. If
> > a sender did not get a response to first of them, sending another one
> > probably will not increase its chances. To me, saying that only one ping is
> > allowed is a simplification of the protocol which does not limit protocol’s
> > functionality.
> 
> 
> I agree that multiple outstanding pings do not initially appear useful.
> 
> But then I don't see why we need to restrict it to only 1.    Either
> it will not have a use and thus nobody will send multiple pings,  or
> somebody will discover a use and we should let them.

Naturally I have a use, and it came up in my very first application
for WebSocket.  What follows is an example.

A server needs to know which clients are currently "online" for the
purpose of reporting this to other clients, detecting dead clients etc.

"Online" is defined (in this example) as "received something in the
last 30 seconds".  This ensures it's fairly up to date, which is
important in a number of applications.

No guarantees can be made about the network, but we choose to treat a
delay of up to 10 seconds in the client-to-server direction as acceptable.
(This is based on 3G experiences, which commonly delay for that long.)

Therefore the client sends 1 ping message every *20* seconds, if there
is no other client-to-server data.

The client must send another ping after 20 seconds even if it hasn't
had a pong for the previous ping yet.

Pongs can be delayed quite a lot due to queueing behind other
messages already queued from server-to-client, plus network delays.

If the client had to wait for pong before sending another ping, that
would cause spurious "offline" statuses whenever there was a lot of
data transiting in server-to-client direction.  Or we'd have to use a
custom keepalive protocol to avoid the restriction.  Or we couldn't
provide such an up to date measure.

(In reality we'll probably use a custom keepalive protocol anyway, to
reduce the amount of packets needed, but that's a separate issue.)

-- Jamie