3 ms·
Multiplexing RPCs onto a single WebSocket has some serious downsides. For one you now have an entirely custom protocol that standard proxies will not understand
by louiscryan 12y ago
Multiplexing RPCs onto a single WebSocket has some serious downsides. For one you now have an entirely custom protocol that standard proxies will not understand and cannot route. GRPC is very careful to be valid HTTP/2 for this reason.
One of the major reasons for the existence of WebSocket is to support duplex streaming. HTTP/2 explicitly states
"A server can
send a complete response prior to the client sending an entire
request if the response does not depend on any portion of the request
that has not been sent and received"
With better HTTP APIs (particularly in the browser) you would get full-duplex and the need for WebSocket would diminsh.