Needs advice
on
gRPCgRPC

What to use when and what is the main difference between gRPC or WebSockets. Is Websockets using HTTP 1.0, then how it is bidirectional?

READ LESS
4 upvotes·94.4K views
Replies (3)
Senior Software Engineer at Mews·
Recommends
on
gRPC
Socket.IO

WebSocket is a low-level transport protocol which provides bidirectional communication channel between client and server. HTTP is only used for establishing the connection.

gRPC is a higher-level RPC framework which builds on top of HTTP/2. Bidirectional communication channel is provided by HTTP/2.

So the comparison here should be either between WebSocket and HTTP/2, or gRPC and some WebSocket framework, for example Socket.IO. WebSocket can be seen as obsolete technology compared to HTTP/2 for majority of use cases (exception being handling of binary data on JavaScript client). With emergence of HTTP/3 (aka QUIC) there's also a new web technology WebTransport.

READ MORE
4 upvotes·304 views

Hi i'using gRPC. Its bi-directional in 2 ways: Bi direction can be archived in following way: 1) Create gRPC server1 2) Create gRPC server 2 Each with its own interface 3) Connect Server 1 as Client of server 2 4) Connect Server2 as Client of server 1 5) Now you are fully bi-directional

Simplier Bi-directionalita may be archived by: 1) Create gRPC Server 2) Connect to server with a client 3) Once you invoke some method an answer will be returned (in sync / async ways) [Remote procedure call]

READ MORE
2 upvotes·2 comments·235 views
Miguel Acevedo
Miguel Acevedo
·
September 10th 2021 at 4:13AM

For websocket to make it bidirectional it use a call and long waiting (long timeout for the call) so can wait for message, it’s a workaround, if you can I would use grpc (I use it for server to server communication), for more details for websocket you can check this article: https://sookocheff.com/post/networking/how-do-websockets-work/

·
Reply
Garth Michel
Garth Michel
·
February 8th 2022 at 6:16PM

gRPC has a bunch of advantages over websockets. You can use it single connection/request/close connection, you can do streaming, or you can do bi-directional streaming.

Another advantage is that you have a singular definition language for your messages, which is strong typed. You're also able to generate libs for running your server in many different languages (13 I think), as well as for connecting to the server. You can have your server running written in Go, or Rust, while you might be connecting with PHP, or Python.

·
Reply
View all (3)
Avatar of ufclass