httpwebsocketgrpchttp2http3

Are HTTP/2 and HTTP/3 still a request and response based protocol?


This RFC for HTTP/1.1 says

The HTTP protocol is a request/response protocol.

Moving to newer HTTP protocols - HTTP/2 spec says that each stream is a bidirectional sequence of frames. Both client and the server can initiate stream creation. (Although server stream creation is in response to a client request and only mentioned with regards to H2 server push which is not relevant anymore)

gRPC and Websockets are run on a single client initiated H2 stream as well. Both allows bidirectional communication.


Solution

  • Does this mean that H2 and H3 are no more request/response protocols?

    They're still request/response protocols. You can build other kinds of protocols on top of that, but they're still request/response. Or you can define "request/response" in a very strict way such that HTTP/2 isn't, but then HTTP/1.1 isn't either when it's being used with BOSH. It's not a particularly meaningful designation.

    Is a single H2 stream full duplex?

    Yes. H2 streams are bidirectional.

    Can the server send unsolicited messages to the client?

    Not specifically, but that's not how WebSockets work over HTTP/2. See RFC 8441.