Documentation ¶
Overview ¶
Package jsonrpc2ws provides websocket implement of jsonrpc2(https://godoc.org/github.com/c0mm4nd/go-jsonrpc2), the fast jsonrpc 2.0 message encoding and decoding Visit repo https://godoc.org/github.com/c0mm4nd/go-jsonrpc2 and get example
Index ¶
- type Client
- func (c *Client) ReadMessage() (messageType int, message *jsonrpc2.JsonRpcMessage, err error)
- func (c *Client) ReadMessageBatch() (messageType int, message *jsonrpc2.JsonRpcMessageBatch, err error)
- func (c *Client) ReadRawMessage() (messageType int, message []byte, err error)
- func (c *Client) WriteMessage(messageType int, message *jsonrpc2.JsonRpcMessage) error
- type ClientConfig
- type HandlerConfig
- type Logger
- type Server
- type ServerConfig
- type SimpleLogger
- type StatefulJsonRpcHandler
- type WSHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { *websocket.Conn ClientConfig }
func NewClient ¶
func NewClient(config ClientConfig) (*Client, error)
func (*Client) ReadMessage ¶
func (*Client) ReadMessageBatch ¶
func (*Client) ReadRawMessage ¶
func (*Client) WriteMessage ¶
type ClientConfig ¶
type HandlerConfig ¶
type HandlerConfig struct { Logger Logger HandlerMap map[string]StatefulJsonRpcHandler }
type ServerConfig ¶
type SimpleLogger ¶
type SimpleLogger struct{}
func (*SimpleLogger) Debug ¶
func (logger *SimpleLogger) Debug(args ...interface{})
func (*SimpleLogger) Error ¶
func (logger *SimpleLogger) Error(args ...interface{})
type StatefulJsonRpcHandler ¶
type WSHandler ¶
type WSHandler struct { HandlerConfig // contains filtered or unexported fields }
WSHandler is acting as a http.Handler and will redirect the jsonrpc message to one of the registered jsonrpc handlers on its handler table
func NewWSHandler ¶
func NewWSHandler(config HandlerConfig) *WSHandler
func (*WSHandler) RegisterJsonRpcHandleFunc ¶
func (*WSHandler) RegisterJsonRpcHandler ¶
func (h *WSHandler) RegisterJsonRpcHandler(method string, handler StatefulJsonRpcHandler)
Click to show internal directories.
Click to hide internal directories.