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 bbcd338583 update go.mod 5 years ago
LICENSE add license file 6 years ago
README.md v0.0.1 6 years ago
go.mod update go.mod 5 years ago
go.sum update go.mod 5 years ago
http_transport.go go fmt 5 years ago
jsonrpc.go use context 6 years ago
jsonrpc_test.go add websocket support 6 years ago
transport.go go fmt 5 years ago
websocket_transport.go fix subscribe process issue 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)
}