# README
Go-gRPC-Demo
Why?
In a REST or GraphQL architecture we have
Client sending request
Server giving response
But this process is
How?
How to make the client server intercation Scalable?For that we use Remote Procedure Calls (RPC)
RPC directly calls functions from client to server
Instead of JSON, we use protobuf files
Here, payload size is small and accelerates communication
Client Server communication can happen via Streaming (sequences of mesages)
Stream is continous flow of data
Its asynchronous
Extremely scalable
Usecase: MICROSERVICES!, Blockchains
There are mainly 4 types of communications in GRPC
-
Unary API
Regular request-response
-
Server Streaming
Client sends a request to server
Server sends a strea of data to client
-
Client Streaming
Client sends a stream of data to server
Server provides a siple response to client
-
Bi-Directional Streaming
Both client and server can communicate via streaming.
And they can do this parallely,
Not like request response wehre client sneds first and then server gives response - not like this.
Its like a two way-traffic
Even though its a stream, not a queue, sequence of messages is preserved
To Run the project
Install the dependenciesgo mod tidy
Run the server
go run server/main.go
Run the client
go run client/main.go