tanszek:oktatas:iss_t:json-rpc
This is an old revision of the document!
JSON-RPC
1. Introduction
JSON-RPC (JavaScript Object Notation – Remote Procedure Call) is a lightweight remote procedure call protocol that uses JSON for encoding messages. It allows a client to call functions (methods) on a remote server as if they were local functions.
Unlike REST, which is resource-oriented, JSON-RPC is procedure-oriented: the client explicitly calls a named method and passes parameters.
JSON-RPC is:
- transport-independent (commonly used over HTTP, WebSocket, TCP) - which means the protocol defines only the message format and not the communication channel. It can run over HTTP, HTTPS, WebSocket, raw TCP sockets, message queues, or even serial connections in embedded systems. Because it is transport-agnostic, it can be integrated into very different infrastructures without changing the protocol itself.
- stateless - each request contains all the information necessary for execution: the method name, parameters, and request identifier. The server does not need to store session data between calls. This design improves scalability and makes horizontal load balancing easier in distributed systems and microservice architectures.
- lightweight - The message structure is minimal and contains only a few required fields. There are no built-in resource descriptions, URL hierarchies, or protocol-specific metadata. As a result, payload sizes are typically small and parsing logic is simple, which is beneficial in high-performance systems, internal APIs, and resource-constrained environments such as IoT devices.
- simple to implement - Since JSON parsing libraries are available in nearly every programming language, creating a JSON-RPC server usually requires only a JSON parser, a method-dispatch mechanism that maps method names to functions, and structured error handling.
- language-independent - Because JSON is a universal data interchange format, clients and servers can be implemented in different programming languages without compatibility issues. A Python client can communicate with a Java or C++ server as long as both follow the JSON-RPC 2.0 specification.
The current widely used version is JSON-RPC 2.0. https://www.jsonrpc.org/specification
tanszek/oktatas/iss_t/json-rpc.1772384532.txt.gz · Last modified: 2026/03/01 17:02 by knehez
