grpc(and socket?)


In gRPC, a client application can directly call a method on a server application on a different machine as if it were a local object, making it easier for you to create distributed applications and services. As in many RPC systems, gRPC is based around the idea of defining a service, specifying the methods that can be called remotely with their parameters and return types. On the server side, the server implements this interface and runs a gRPC server to handle client calls. On the client side, the client has a stub (referred to as just a client in some languages) that provides the same methods as the server.

 

 

 

gRPC 是基於 HTTP/2 協議的,所以即使他能做到雙向通信也會是類似websocket通信。而且grpc本身就是強區分客戶端服務端,不為雙向通信設計。

和socket相比:

gRPC 最大優勢是編碼使用protobuf,具備語言兼容性。使用 protocol buffers 的好處,包括高效的序列號,簡單的 IDL 以及容易進行接口更新。 --不過反過來講實際只使用protorbuf編碼或者json編碼同樣可具備語言兼容性。

但是它和socket通信本身就是不同的東西,要解決的問題完全就是不同的。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM