Subject: [hybi] Question about TCP reuse.

From: Tordek <[email-masked]>
Date: Mon, 06 Aug 2012 19:21:43 -0300

Can a TCP connection be reused for WS after an HTTP request has been 
made?

Is a client allowed such an optimization? Is the server allowed or 
expected to accept this behavior?

In short, what should the behavior of this interaction be:

Open a connection S to example.com.
s <- "GET / HTTP/1.1 Host: example.com"
s -> read data (presumably a script requesting a websocket into 
ws://example.com.)
s <- "GET / HTTP/1.1 Host: example.com Connection: Upgrade Upgrade: 
websocket"
s -> ?

---

From: Bjoern Hoehrmann <[email-masked]>
Date: Tue, 07 Aug 2012 17:51:02 +0200

>Can a TCP connection be reused for WS after an HTTP request has been 

Last I heard the Working Group's position was that the protocol is HTTP
until after the Websocket handshake has been completed and I'm not aware
of the RFC saying anything to the contrary; so, sure, that is an option,
and depending on intermediaries, it might be hard to avoid.
-- 
Björn Höhrmann · mailto:[email-masked] · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/

---

From: Patrick McManus <[email-masked]>
Date: Tue, 07 Aug 2012 23:02:09 -0400

> and depending on intermediaries, it might be hard to avoid.

yes - firefox actually will reuse an idle persistent connection to 
bootstrap into websockets if it is convenient to do so. Saves a round trip.