Skip to content

A remote procedure call (RPC) framework using the JSON format.

License

Notifications You must be signed in to change notification settings

vault-thirteen/JSON-RPC-M1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON-RPC M1

A remote procedure call framework written in Go programming language.

Yes, this is a framework, not a library, while it does not allow to automate the process of creation of an RPC infrastructure. Unfortunately, Go language does not fully support dynamic typing. It would be possible to automate the process of encoding and decoding of requests and responses, but it would need to use the "Reflection" feature of the language, which works about a hundred times slower than a normal code.

This framework helps in implementing an RPC server and RPC client using the JSON-RPC M1 protocol. More information about the JSON-RPC M1 protocol can be found in its repository: https://github.com/vault-thirteen/JSON-RPC-M1-Specification

Usage Example

A very simple usage example is available in the example\simple folder of this repository. A description and more information can be found there.

Features

The framework offers several features useful in practice.

  • Settings of this framework are configurable. For example, you can set your own HTTP client using TLS, etc.
  • The RPC server is able to catch and log exceptions (called "panic" in Go language).
  • The framework can count the requests.
  • The framework can measure time taken to perform function calls on the server side.
  • The framework allows user's function to see an ID of a request.
  • The framework allows to set additional meta information in request and response.
  • The framework uses a simple and robust protocol, which is focused on data safety and reliability.
  • The framework is very simple and does not require external tools.

As opposed to many other RPC protocols, this framework has some limits, which are the result of its simplicity.

  • One-side messages are forbidden.
    • Every request must be "acknowledged" with a response.
    • If you need an RPC for game servers, use the UDP protocol and do not cry when someone de-synchs.
  • Batch function calls are forbidden for safety reasons.
    • If you need to call for several functions, make several function calls.
  • The client makes one request at a time.
    • If you need to send spam to the server, use something else.
  • Error codes are not compatible with Google's JSON RPC and XML RPC protocols.
    • We are not Google.
  • This framework is not going to be as fast as GRPC with Protocol Buffers.
    • As with all the protocols using JSON format, textual format is always slower than a binary one.

About

A remote procedure call (RPC) framework using the JSON format.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages