What rpc can make a difference and where it is better to use ?
Advantages of rpc
Main advantage I see is that you're forced to catch more errors at compile time.
This post on gRPC-Web: Moving past REST+JSON towards type-safe Web APIs says:
"
- No more hunting down API documentation – .proto is the canonical
format for API contracts, just like in other teams
- No more hand-crafted JSON call objects – all requests and responses are strongly typed and code-generated, with hints available
in the IDE
- No more dealing with methods, headers, body and low level networking – everything is handled and abstracted away in the
grpc-web-client
- No more second-guessing the meaning of HTTP error codes – gRPC status codes are a canonical way of representing issues in APIs
No more hand-crafted chunk-encoded streaming madness on the server – gRPC-Web supports both 1:1 RPCs and 1:many server-side
streaming requests
- No more data parse errors when rolling out new binaries – backwards and forwards-compatibility of requests and responses is
guaranteed by protocol buffers
"
Advantages of protocol oriented architecture
Main advantage I see is that you have standard operations and common concepts that can be reused in different scenarios.
In Richardson Maturity Model - steps toward the glory of REST the concept of different levels is introduced. You can extract some advantages from there.
"
Level 1 tackles the question of handling complexity by using divide and conquer, breaking a large service endpoint down into multiple resources.
Level 2 introduces a standard set of verbs so that we handle similar situations in the same way, removing unnecessary variation.
Level 3 introduces discoverability, providing a way of making a protocol more self-documenting.
"
When to use what?
Maybe rpc is good for in-house usage when you have a team of domain experts that is not familiar with HTTP or other common protocols. It has also advantages in backend-to-backend communication where no browsers are involved. With technologies like gRPC one can support communication between multi languages/technologies.
In all other cases HTTP-like communication still seems the standard for most use cases in 2017?