CovenantSQL: github.com/CovenantSQL/CovenantSQL/rpc/jsonrpc Index | Files

package jsonrpc

import "github.com/CovenantSQL/CovenantSQL/rpc/jsonrpc"

Index

Package Files

handler.go middleware.go websocket.go

func RegisterMethod Uses

func RegisterMethod(method string, handlerFunc HandlerFunc, paramsType interface{})

RegisterMethod register a method to the default handler.

type Handler Uses

type Handler struct {
    // contains filtered or unexported fields
}

Handler is a handler handling JSON-RPC protocol.

func NewHandler Uses

func NewHandler() *Handler

NewHandler creates a new JSONRPCHandler.

func (*Handler) Handle Uses

func (h *Handler) Handle(ctx context.Context, conn *jsonrpc2.Conn, req *jsonrpc2.Request)

Handle implements jsonrpc2.Handler.

func (*Handler) RegisterMethod Uses

func (h *Handler) RegisterMethod(method string, handlerFunc HandlerFunc, paramsType interface{})

RegisterMethod register a method.

type HandlerFunc Uses

type HandlerFunc func(context.Context, *jsonrpc2.Conn, *jsonrpc2.Request) (interface{}, error)

HandlerFunc is a function adapter to Handler.

type Validator Uses

type Validator interface {
    Validate() error
}

Validator is designed for params checking.

type WebsocketServer Uses

type WebsocketServer struct {
    http.Server
    RPCHandler jsonrpc2.Handler
}

WebsocketServer is a websocket server providing JSON-RPC API service.

func (*WebsocketServer) Serve Uses

func (ws *WebsocketServer) Serve() error

Serve accepts incoming connections and serve each.

func (*WebsocketServer) Stop Uses

func (ws *WebsocketServer) Stop()

Stop stops the server and returns a channel indicating server is stopped.

Package jsonrpc imports 12 packages (graph) and is imported by 2 packages. Updated 2019-03-20. Refresh now. Tools for package owners.