1

What is special about a remote procedure call?

From what I have seen so far, they seem to have similar functionalities as a HTTP API or TCP API. Why not just use a http/tcp api?

As a developer that wishes to open up an API, why would I choose to use JSON RPC over a HTTP or TCP API (with a JSON encoded payload)

4
  • 1
    JSON RPC is simply a slightly-higher level of abstraction. You could, in theory, replace the transfer layer below it (e.g. swapping HTTP for UDP) without changing anything at the higher level. Commented Nov 27, 2013 at 22:44
  • @EricLaw: I was with you right up the point where you said you can replace HTTP with UDP - no you can't - you can replace TCP with UDP (as per Google's QUIC) and similarly HTTP could (in theory) be replaced by SMTP - but you can't exchange components from different levels in the stack. Commented Nov 27, 2013 at 23:18
  • so whici level of abstraction is RPC? is RPC at the application layer? Commented Nov 27, 2013 at 23:41
  • 1
    @symcbean: I think you're confused. HTTP is an abstraction which typically runs on TCP, but as you noted it can run on UDP, or you can ditch the HTTP abstraction entirely if desired. That's the whole point of choosing a higher-level of abstraction-- it enables swapping (or even removing) use of lower-level protocols. Commented Nov 29, 2013 at 20:44

1 Answer 1

1

RPC is a different type of architecture that predates REST - it is more focused on procedures while REST focuses on exposing resources with a consistent API.

RPCs are most often found in legacy code and in cases where REST may not be appropriate.

Sign up to request clarification or add additional context in comments.

5 Comments

so you can really create a http api (with JSON body for example) to replace JSON RPC? I mean, there is nothing fundamentanlly different about a RPC right?
Could you explain where HTTP API might not be appropriate?
I modified to question slightly for a comparison between RPC and http or tcp api. As a developer, why would I choose to use JSON RPC rather than HTTP or TCP API
Because REST provides a more specific definiton of the implementation, hence it's a lot easier to get 2 ends of a communication to talk to each other.
RPC lets you in run a procedure we the the same interface as if you here running it locally. A use case could be eg. running an computationally heavy algorithm in a cluster.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.