- RPC - Remote Procedure Call
- RPC is a method of communication btw two programs (even across systems) through function calls
- RPC abstracts the call to the other program in a remote system to a local function call
- The remote program also returns the result to the calling program
- Can be stateful
- RPC usually has only one endpoint, the function being called is added as a part of the message
RPC vs REST
RPC is about invoking certain actions and expecting responses,
// client
message UserRequest {
int32 user_id = 1;
}
// server
service UserService {
rpc GetUser (UserRequest) returns (UserResponse);
}
message UserResponse {
string username = 1;
int32 age = 2;
}
REST is about asking questions about resources and getting information in return,
GET /users/{userID}