You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dingjun bbb112b301 | 5 years ago | |
---|---|---|
LICENSE | 6 years ago | |
README.md | 6 years ago | |
go.mod | 5 years ago | |
go.sum | 5 years ago | |
http_transport.go | 5 years ago | |
jsonrpc.go | 6 years ago | |
jsonrpc_test.go | 6 years ago | |
transport.go | 5 years ago | |
websocket_transport.go | 5 years ago |
README.md
jsonrpc
simple jsonrpc 2.0 client
usage
example
package main
import (
"github.com/fangdingjun/jsonrpc"
"log"
)
type result struct{
R1 string `json:"r1"`
R2 string `json:"r2"`
}
func main(){
client, _ := jsonrpc.NewClient("http://admin:123@127.0.0.1:2312/jsonrpc")
// client.Debug = true
// client.HTTPClient = &http.Client{...}
var ret result
var args = []interface{}{1, "a", 2}
err := client.Call("some_method", args, &ret)
if err != nil{
log.Fatal(err)
}
log.Println(ret)
}