Re: [hybi] NAT reset recovery? Was: Extensibility mechanisms?

<Markus.Isomaki@nokia.com> Mon, 19 April 2010 19:54 UTC

Return-Path: <Markus.Isomaki@nokia.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 C24833A6AE5 for <hybi@core3.amsl.com>; Mon, 19 Apr 2010 12:54:23 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -5.854
X-Spam-Level:
X-Spam-Status: No, score=-5.854 tagged_above=-999 required=5 tests=[AWL=-0.744, BAYES_05=-1.11, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-4]
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 kFfnS7rNX1M3 for <hybi@core3.amsl.com>; Mon, 19 Apr 2010 12:54:22 -0700 (PDT)
Received: from mgw-mx09.nokia.com (smtp.nokia.com [192.100.105.134]) by core3.amsl.com (Postfix) with ESMTP id 0A2C83A6943 for <hybi@ietf.org>; Mon, 19 Apr 2010 12:54:19 -0700 (PDT)
Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o3JJrG8j020964; Mon, 19 Apr 2010 14:54:08 -0500
Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 19 Apr 2010 22:53:38 +0300
Received: from smtp.mgd.nokia.com ([65.54.30.6]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Mon, 19 Apr 2010 22:53:32 +0300
Received: from NOK-EUMSG-02.mgdnok.nokia.com ([65.54.30.87]) by nok-am1mhub-02.mgdnok.nokia.com ([65.54.30.6]) with mapi; Mon, 19 Apr 2010 21:53:31 +0200
From: Markus.Isomaki@nokia.com
To: vladimir@d2dx.com, hybi@ietf.org
Date: Mon, 19 Apr 2010 21:53:30 +0200
Thread-Topic: [hybi] NAT reset recovery? Was: Extensibility mechanisms?
Thread-Index: AcrfzfEJtaYknfGvT1KVoLr7U7hLogAKJBVw
Message-ID: <B3F72E5548B10A4A8E6F4795430F841832040F78C0@NOK-EUMSG-02.mgdnok.nokia.com>
References: <Pine.LNX.4.64.1004181812370.751@ps20323.dreamhostps.com> <4BCB6641.70408@webtide.com> <Pine.LNX.4.64.1004182010070.751@ps20323.dreamhostps.com> <4BCB6FD0.7080003@webtide.com> <j2n5c4444771004181403o81184b00r294f3c3b878f24f6@mail.gmail.com> <20100419091736.GA28758@shareable.org> <p2w2a10ed241004190222ne3a61417i47b021dbe0422f71@mail.gmail.com> <B3F72E5548B10A4A8E6F4795430F841832040920C4@NOK-EUMSG-02.mgdnok.nokia.com> <20100419121000.GG28758@shareable.org> <87764B8E-5872-40EE-AA2F-D4E659B94F63@d2dx.com> <20100419140423.GC3631@shareable.org> <6959E9B3-B1AC-4AFB-A53D-AB3BA340208C@d2dx.com>
In-Reply-To: <6959E9B3-B1AC-4AFB-A53D-AB3BA340208C@d2dx.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
acceptlanguage: en-US
Content-Type: multipart/alternative; boundary="_000_B3F72E5548B10A4A8E6F4795430F841832040F78C0NOKEUMSG02mgd_"
MIME-Version: 1.0
X-OriginalArrivalTime: 19 Apr 2010 19:53:32.0420 (UTC) FILETIME=[FD5F1C40:01CADFF9]
X-Nokia-AV: Clean
Subject: Re: [hybi] NAT reset recovery? Was: Extensibility mechanisms?
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: Mon, 19 Apr 2010 19:54:23 -0000

Hi,

How about this:

I think the websocket spec should define two special frames explicitly for keepalive purpose:
- Keepalive request frame; this is sent by the client
- Keepalive response frame; this is sent by the server as a response to the keepalive request
Depending on what the websocket protocol syntax allows, these frames could be actually just single bytes (frames starting between 0x80 and 0xFF seem to be reserved for something special, so we would use two of these code points).

The client would generate the keepalive requests as often as needed when there is no other traffic frequently enough. By the response from the server the client would know that the transport connection (TCP) is still up, the NAT and intermediary state is thus also up, and actually the server is also alive on the app layer.

How often the keepalives are sent is a tricky question, and may be beyond what is defined in the websocket protocol, as it depends so much in the environment (the middleboxes in the access networks, the web intermediaries and so on), and on the other hand sending too often consumes battery on wireless devices. The client can find out the optimal rate in its current environment by trial and error. What could be done is that the server might be able to hint the client on a suitable rate, although typically the server has no idea on e.g. NAT timeouts in the network the client is located (but in principle it could remember which values worked last time from that particular IP range). That would make the keepalive frames slightly more complicated but still within a few bytes. Yet another option is actually to standardize some kind of keepalive rate iteration algorithm.

Basically all other protocols that need to maintain long-lived TCP connections have done this: SIP and XMPP exchange 'CRLF's between client and server, for instance. HTTP based long-polling protocols send entire HTTP requests.

Markus


________________________________
From: hybi-bounces@ietf.org [mailto:hybi-bounces@ietf.org] On Behalf Of ext Vladimir Katardjiev
Sent: 19 April, 2010 17:29
To: Hybi
Subject: Re: [hybi] NAT reset recovery? Was: Extensibility mechanisms?


On 19 apr 2010, at 16.04, Jamie Lokier wrote:

Vladimir Katardjiev wrote:
- Our hypothetical amateur programmer, testing his websocket
connection against localhost, won't see the need for keepalives, but
the protocol requiring them will stop his application from failing
on the Wild Web. All he needs to do is echo back the bytes the
browser sent, and the expert browser programmer handles the rest.

Keepalives are great, but this isn't a nice way to implement them.

If they are required by the protocol, then the protocol should
implement them itself.  (Besides, echo-reply isn't always bandwidth
efficient, depending on keepalive the needs of client and server).

Yeah, it's not the best but it fulfils the design pattern that has been pre-eminent throughout the WebSocket spec -- that everything should be verifiable by the client, because that is the only "trusted" side. While I don't agree with the assumption that only the client should ever be trusted, it is a sufficient base case and only incurs trivial complexity increase by the server. Better an agreement on _a_ keepalive than no keepalive agreement?

So I'd rather say I am having trouble seeing what applications would _not_ want keepalive functionality as part of the base offering of WebSockets.

Well, there may be disagreement over what type of keepalive, because
the optimal choice is both application dependent _and_ network link
dependent.

I'd love to have that discussion. It means there'd be an acceptance of keepalives as part of the WebSocket spec.

At the moment, it can be implemented by the WebSocket application
(albeit suboptimally, and any network link dependency has to be known
to the application as well).

Yeah... question is if this functionality isn't better handled by WebSockets for a majority of the applications, and the rest can opt out of it.

Vladimir