Re: 6455 Websockets and the relationship to HTTP

On 12/23/2016 03:40 PM, Mark Nottingham wrote:
> Sorry to perpetuate this thread, but...
>
> On 15 Dec. 2016, at 11:39 am, Wenbo Zhu <wenboz@google.com> wrote:
>>
>> On non-browsers,
>
> *confused*
>
> AIUI the *only* reasonable use case for WebSockets is browsers; who is using it without a browser?
>
> (keeping in mind that WS is effectively TCP constrained by the Web security / same-origin model)

The three bigger Websocket users I have seen are:

* browsers;
* phone applications;
* servers

Excluding Websocket sub protocols, generally the pattern is the same: a 
server has an HTTP API and some of that API is implemented using 
Websocket to allow the server to push data to the client.

This usage can arguably be replaced by HTTP/2 with push. It is closer in 
spirit to text/event-stream, while also allowing binary data without 
using base64 on that data beforehand. It's not TCP but rather a more 
generalized event push mechanism than text/event-stream provides.

Most of the cases I have seen the usage is much lighter than HTTP/2 push 
provides; there's no cache involved, and the intent is to send the event 
to the client as soon as possible (ie without having to go through the 
push promise and response headers first).

A Websocket over HTTP/2 would allow those users to use the HTTP and 
Websocket API over a single connection.

Servers that use Websocket to speak to each other simply use the same 
interface other clients do. For servers it's more about code reuse than 
any other considerations. Developer implements HTTP/Websocket server for 
phone apps; writes a client module for testing this server; uses the 
client module to speak to other servers.

The same-origin only seems useful for browsers in practice, I have not 
seen it applied elsewhere.

-- 
Loïc Hoguin
https://ninenines.eu

Received on Friday, 23 December 2016 15:29:29 UTC