jsonrpc is an golang implementation just for parse and serialize JSON-RPC2 messages, it's easy to integration with your any application.
Inspired by https://github.com/teambition/jsonrpc-lite and JSON-RPC 2.0 specifications
go get github.com/mushroomsir/jsonrpc
Creates a JSON-RPC 2.0 message structures
id
: {String|Int|nil}method
: {String}params
: {interface{}}, optional
val, err := jsonrpc.Request(123, "update")
{
"jsonrpc": "2.0",
"method": "update",
"id": 123
}
Creates a JSON-RPC 2.0 message structures, the id is automatic generation by strconv.FormatInt(rand.Int63(), 10)
method
: {String}params
: {interface{}}, optional
val, err := jsonrpc.Request("update")
{
"jsonrpc": "2.0",
"method": "update",
"id": randnum
}
Creates a JSON-RPC 2.0 notification message structures
method
: {String}params
: {interface{}}, optional
val, err = jsonrpc.Notification("update")
{
"jsonrpc": "2.0",
"method": "update"
}