github.com/qlcchain/jsonrpc2 (go): Package rpc implements bi-directional JSON-RPC 2.0 on multiple transports.  It provides access to the exported methods of an object across a network or other I/O connection. After creating a server or client instance, objects can be registered to make them visible as 'services'. Exported methods that follow specific conventions can be called remotely. It also has support for the publish/subscribe pattern.  Methods that satisfy the following criteria are made available for remote access:  An example method:  When the returned error isn't nil the returned integer is ignored and the error is sent back to the client. Otherwise the returned integer is sent back to the client.  Optional arguments are supported by accepting pointer values as arguments. E.g. if we want to do the addition in an optional finite field we can accept a mod argument as pointer value.  This RPC method can be called with 2 integers and a null value as third argument. In that case the mod argument will be nil. Or it can be called with 3 integers, in that case mod will be pointing to the given third argument. Since the optional argument is the last argument the RPC package will also accept 2 integers as arguments. It will pass the mod argument as nil to the RPC method.  The server offers the ServeCodec method which accepts a ServerCodec instance. It will read requests from the codec, process the request and sends the response back to the client using the codec. The server can execute requests concurrently. Responses can be sent back to the client out of order.  An example server which uses the JSON codec:  The package also supports the publish subscribe pattern through the use of subscriptions. A method that is considered eligible for notifications must satisfy the following criteria:  An example method:  When the service containing the subscription method is registered to the server, for example under the "blockchain" namespace, a subscription is created by calling the "blockchain_subscribe" method.  Subscriptions are deleted when the user sends an unsubscribe request or when the connection which was used to create the subscription is closed. This can be initiated by the client and server. The server will close the connection for any write error.  For more information about subscriptions, see https://github.com/ethereum/go-ethereum/wiki/RPC-PUB-SUB.  In any method handler, an instance of rpc.Client can be accessed through the ClientFromContext method. Using this client instance, server-to-client method calls can be performed on the RPC connection.
Keywords: jsonrpc2