I don't understand what the ID is for in JSON RPC. Also, how bad is it considered to not use JSON-RPC.org's standards when developing a toolkit? There seems to be some ambiguity in the JSON-RPC world.
P.S. The ID I'm referring to is the id in here:
{"params":["Hello","World"],"method":"hello_world","id":1}
JSON-RPC is simply a remote procedure call protocol that is used on Ethereum to define different data structures. It also defines the rules on how data structures are processed in the network. Because it is transport-agnostic, you can use it to interact with an ETH node over sockets or HTTP.
JSON-RPC is a remote procedure call protocol encoded in JSON. It is similar to the XML-RPC protocol, defining only a few data types and commands.
JSON-RPC is a stateless, light-weight remote procedure call (RPC) protocol. It defines several data structures and the rules around their processing. It is transport agnostic in that the concepts can be used within the same process, over sockets, over HTTP, or in many various message passing environments.
It would be better to choose JSON-RPC between REST and JSON-RPC to develop an API for a web application that is easier to understand. JSON-RPC is preferred because its mapping to method calls and communications can be easily understood.
The "id" is returned in the corresponding response object, so you can map one context to the other.
If you are making synchronous single calls, it might not make sense, but in an async multi-outstanding-call enviroment it is vital.
It should not be hard coded to 1, but set to a unique value for every request object you generate from the client.
You're not guaranteed to get your answers back in the order you asked for them; the id is to help you sort that out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With