4 ms·
As a general question: why I do have to configure any nginx server that I want to use websockets on to specifically use http 1.1 if 2.0 also has support for the
by erinnh 6y ago
As a general question: why I do have to configure any nginx server that I want to use websockets on to specifically use http 1.1 if 2.0 also has support for them?
- chrismorgan 6y agoWebSockets was defined in a way that was incompatible with HTTP/2. RFC 8441 defines a way of reconciling the two, and explains the nature of the problem in its introduction: https://tools.ietf.org/html/rfc8441#section-1 https://tools.ietf.org/html/rfc8441#section-1. But I don’t believe any browsers has landed support for this yet. (In Chrome it’s been behind a flag for 2½ years with apparently no changes for the last two years. No idea what the hold-up is. https://www.chromestatus.com/feature/6251293127475200 https://www.chromestatus.com/feature/6251293127475200.)
- pa7x1 6y agoTo add a bit more information to what the sibling post provides. The original WebSocket handshake is done over HTTP/1.1, there is an RFC specifying how to perform the negotiation also over HTTP/2 connection but its support lacking. On top of that, HTTP/2 itself can do full-duplex communication so it can be used as a replacement of WebSocket, no negotiation or protocol upgrade involved. This capability is rarely used though but is, for example, leveraged by gRPC which is able to do bidirectional streaming [1]. [1] https://grpc.io/docs/what-is-grpc/core-concepts/ https://grpc.io/docs/what-is-grpc/core-concepts/