Categorygithub.com/chenxifun/jsonrpc
module
0.0.2
Repository: https://github.com/chenxifun/jsonrpc.git
Documentation: pkg.go.dev

# README

jsonrpc

从ETH拆出来的一个 json-rpc框架,支持http以及ws
使用方式

srv := server.NewServer(config.DefaultConfig())
apis := []rpc.API{rpc.API{
Namespace: "test",
Public:    true,
Service:   NewHello(),
Version:   "1.2",
},
}

if err := srv.RegisterServices(apis, []string{"test"});err != nil {
t.Fatal(err)
}

if err := srv.Start();err != nil {
t.Fatal(err)
}

调用示例

cli, err := rpc.Dial("ws://127.0.0.1:8003")
if err != nil {
t.Fatal(err)
}

var res string
err = cli.Call(&res, "test_hello", "yaya")
if err != nil {
t.Fatal(err)
}
defer cli.Close()
fmt.Println(res)

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author