4 ms·
Does anyone know when to choose http2 vs websockets?
by gfd 5y ago
Does anyone know when to choose http2 vs websockets?
- anderspitman 5y agoI'm assuming you mean HTTP/2 with Server-Sent Events, since raw HTTP/2 frames aren't exposed in the browser? My answer would be use HTTP/2 + SSE whenever you can get away with it. The primary limitation of SSE in this case is you can't natively send binary data (you would have to base64 encode it or something). If you're just using JSON or another text format anyway this isn't an issue.
- 62951413 5y agoWouldn't HTTP2 imply https://github.com/grpc/grpc-web https://github.com/grpc/grpc-web instead?
- anderspitman 5y agoMaybe. I've never seriously considered grpc-web since it requires a special proxy (Envoy) to work. Seems like too many layers of complexity at that point.