Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/powerman/rpc-codec

JSON-RPC 2.0 codec for Go net/rpc standard library
https://github.com/powerman/rpc-codec

go golang golang-library json-rpc json-rpc2 rpc

Last synced: 13 days ago
JSON representation

JSON-RPC 2.0 codec for Go net/rpc standard library

Awesome Lists containing this project

README

        

# JSON-RPC 2.0 [![GoDoc](https://godoc.org/github.com/powerman/rpc-codec/jsonrpc2?status.svg)](http://godoc.org/github.com/powerman/rpc-codec/jsonrpc2) [![CircleCI](https://circleci.com/gh/powerman/rpc-codec.svg?style=svg)](https://circleci.com/gh/powerman/rpc-codec) [![Coverage Status](https://coveralls.io/repos/powerman/rpc-codec/badge.svg?branch=master&service=github)](https://coveralls.io/github/powerman/rpc-codec?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/powerman/rpc-codec)](https://goreportcard.com/report/github.com/powerman/rpc-codec)

jsonrpc2 is a codec for net/rpc.

Implements [JSON-RPC 2.0](http://www.jsonrpc.org/specification) and
[JSON-RPC 2.0 Transport: HTTP](http://www.simple-is-better.org/json-rpc/transport_http.html)
specifications with following limitations:

- Client: Batch Request not supported.
- HTTP Client&Server: Pipelined Requests/Responses not supported.
- HTTP Client&Server: GET Request not supported.

Also provides command-line tool `jsonrpc2client`.

## Installation

```sh
go get github.com/powerman/rpc-codec/...
```

Or, if you need only `jsonrpc2client` tool, then download binary for your
OS manually from
[releases](https://github.com/powerman/rpc-codec/releases) or run this to
install the latest version:

```sh
curl -sfL $(curl -s https://api.github.com/repos/powerman/rpc-codec/releases/latest | grep -i /jsonrpc2client-$(uname -s)-$(uname -m)\" | cut -d\" -f4) | sudo install /dev/stdin /usr/local/bin/jsonrpc2client
```

## Usage

### jsonrpc2client

```
$ jsonrpc2client -h
Usage: jsonrpc2client [flags] method params-as-json
-http.endpoint string
service endpoint as url
-notification
send notification request
-tcp.addr string
service endpoint as host:port
-transport string
transport (stdin|tcp|http) (default "http")
-version
print version
$ jsonrpc2client -http.endpoint https://example.com/rpc method.name '{"namedArg1":"value"}'
$ jsonrpc2client -http.endpoint https://example.com/rpc method.name '["positionalArg1"]'
```