{"repo":"ybbus/jsonrpc","free":true,"listed":false,"github":"https://github.com/ybbus/jsonrpc","clone":"git clone https://github.com/ybbus/jsonrpc.git","description":"A simple go implementation of json rpc 2.0 client over http","language":"Go","stars":372,"topics":["json-rpc","golang"],"license":"MIT","category":"dev-tools","readme_excerpt":"JSON-RPC 2.0 Client for golang A go implementation of an rpc client using json as data format over http. The implementation is based on the JSON-RPC 2.0 specification: http://www.jsonrpc.org/specification Supports: - requests with arbitrary parameters - convenient response retrieval - batch requests - custom http client (e.g. proxy, tls config) - custom headers (e.g. basic auth) Installation (You can find v2 and v1 in a separate branch.) Getting started Let's say we want to retrieve a person struct with a specific id using rpc-json over http. Then we want to save this person after we changed a property. (Error handling is omitted here) In detail Generating rpc-json requests Let's start by executing a simple json-rpc http call: In production code: Always make sure to check err != nil first! This calls generate and send a valid rpc-json object. (see: http://www.jsonrpc.org/specification#request object) Call a function with parameter: Call a function with arbitrary parameters: Call a function providing custom data structures as parameters: Complex example: Some examples and resulting JSON-RPC objects: Working with rpc-json responses Before working with the response object, make sure to check err != nil. Also keep in mind that the json-rpc result field can be nil even on success. If an http error occurred, maybe you are interested in the error code (403 etc.) The next thing you have to check is if an rpc-json protocol error occurred. This is done by checking if the Error field in","default_branch":null,"files":null,"tree":[],"storefront":"/r/ybbus","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ybbus/jsonrpc/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}