Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
rpc
✓ github.com/gorilla/rpc
Set up a JSON RPC server with a HelloService
package main
import (
"net/http"
"github.com/gorilla/rpc"
"github.com/gorilla/rpc/json"
)
type HelloService struct{}
func (h *HelloService) Say(r *http.Request, args *struct{Name string}, reply *struct{Message string}) error {
reply.Message = "Hello, " + args.Name
return nil
}
func main() {
s := rpc.NewServer()
s.RegisterCodec(json.NewCodec(), "application/json")
s.RegisterService(new(HelloService), "")
http.Handle("/rpc", s)
http.ListenAndServe(":8080", nil)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
1.2.1latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.