What is difference between grpc and websocket? Which one is more suitable for bidirectional streaming connection?

prashant sindhu picture prashant sindhu · Oct 24, 2017 · Viewed 41.5k times · Source

I want to develop a client-server application in a bi-directional streaming manner.

what is more suitable technology for this, grpc or websocket?

Answer

Phil Sturgeon picture Phil Sturgeon · Jan 5, 2018

gRPC is not really the relevant part for comparison, it's that gRPC uses HTTP/2 which can certainly be compared to WebSockets.

https://www.infoq.com/articles/websocket-and-http2-coexist

This article outlines them quite well. Essentially, HTTP/2 is Client/Server with Server Push on the background, so you can make your request and simply stay on that connection listening for updates without the need for polling, for example.

Whilst WebSockets are not going away because of HTTP/2, they might not be considered necessary for use cases that center around "let me know when updates happen related to the thing I just did".