Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WSRPCClient ¶
WSRPCClient is a websocket based rpc client.
func NewClient ¶
func NewClient(origin, wsAddr string) (*WSRPCClient, error)
NewClient returns a new WSRPCClient.
func (*WSRPCClient) Call ¶
func (c *WSRPCClient) Call(serviceMethod string, args interface{}, reply interface{}) error
Call invokes the named function, waits for it to complete, and returns its error status.
type WSRPCServer ¶
type WSRPCServer struct { RPCCodecFunc rpc.ServerCodec // contains filtered or unexported fields }
WSRPCServer is a websocket based rpc server.
func NewServer ¶
func NewServer(addr, wsPath string) *WSRPCServer
NewServer returns a new WSRPCServer.
func (*WSRPCServer) Mux ¶
func (s *WSRPCServer) Mux() *http.ServeMux
Mux returns the http.ServeMux. You can use this mux to config more routers.
func (*WSRPCServer) Register ¶
func (s *WSRPCServer) Register(service interface{})
Register register RPC services.
func (*WSRPCServer) Serve ¶
func (s *WSRPCServer) Serve() error
Serve serves the server. It starts a http server and handle ws requests at path "/ws".
func (*WSRPCServer) ServeHTTP ¶
func (s *WSRPCServer) ServeHTTP(w http.ResponseWriter, req *http.Request)
Click to show internal directories.
Click to hide internal directories.