HTTP/2 and Websockets

Has anyone done any specification on integrating websockets into
HTTP/2? I couldn't find a spec, so I poked around a bit...

It looks to me like there are three issues.

Firstly we should define the handshake in terms of a stream opening on
an existing HTTP/2 connection, and since Upgrade: is not permitted in
HTTP/2 ("
Note:HTTP/2 purposefully does not support upgrade to another protocol.
The handshake methods described in Section 3 are believed sufficient
to negotiate the use of alternative protocols.
")

its not clear to me if that means we need to define a new frame type,
or whether we can still use the Upgrade header sanely.


Secondly, we need to define websocket frame mappings. The least work,
and I suspect the easiest for implementors, would be to put all the
websocket frames into HTTP/2's data frames, without worrying about
frame alignment: just treat the fully open stream as a series of bytes
in the same way TCP is treated by the websocket spec.
I suspect however that a better result would be achieved by defining
custom HTTP/2 frames, since websockets already have the basic support
for multiplexing (large application writes can be fragmented into
smaller frames as needed), we shouldn't run into HOL blocking issues.

Lastly, it seems (to me) that it would be desirable to allow
PUSH_PROMISE setup of websockets connections, but the PUSH_PROMISE
state machine goes straight into half-closed, rather than into 'open',
and that prohibits doing websockets with a pushed connection. There
isn't any prose in HTTP/2 about /why/ the state machine does that :(.

-Rob

-- 
Robert Collins <rbtcollins@hp.com>
Distinguished Technologist
HP Converged Cloud

Received on Monday, 29 September 2014 03:11:26 UTC