Versions in this module Expand all Collapse all v3 v3.1.2 Feb 5, 2024 Changes in this version + const CodeInternalError + const CodeInvalidParams + const CodeInvalidRequest + const CodeMethodNotFound + const CodeParseError + const DefaultHTTPRspBufferSize + const DefaultMaxSleepTime + const JSONRPC + const MAX_JSONRPC_ID + const PathPrefix + const VERSION + var Version = "2.0" + func GetProtocol() protocol.Protocol + type CodecData struct + Args interface{} + Error string + ID int64 + Method string + type Error struct + Code int + Data interface{} + Message string + func NewError(code int, message string) *Error + func (e *Error) Error() string + type HTTPClient struct + ID int64 + func NewHTTPClient(opt *HTTPOptions) *HTTPClient + func (c *HTTPClient) Call(ctx context.Context, service *common.URL, req *Request, rsp interface{}) error + func (c *HTTPClient) Do(addr, path string, httpHeader http.Header, body []byte) ([]byte, error) + func (c *HTTPClient) NewRequest(service *common.URL, method string, args interface{}) *Request + type HTTPOptions struct + HTTPTimeout time.Duration + HandshakeTimeout time.Duration + type JsonrpcExporter struct + func NewJsonrpcExporter(key string, invoker protocol.Invoker, exporterMap *sync.Map) *JsonrpcExporter + func (je *JsonrpcExporter) Unexport() + type JsonrpcInvoker struct + func NewJsonrpcInvoker(url *common.URL, client *HTTPClient) *JsonrpcInvoker + func (ji *JsonrpcInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result + type JsonrpcProtocol struct + func NewJsonrpcProtocol() *JsonrpcProtocol + func (jp *JsonrpcProtocol) Destroy() + func (jp *JsonrpcProtocol) Export(invoker protocol.Invoker) protocol.Exporter + func (jp *JsonrpcProtocol) Refer(url *common.URL) protocol.Invoker + type Request struct + ID int64 + type Server struct + func NewServer() *Server + func (s *Server) Start(url *common.URL) + func (s *Server) Stop() + type ServerCodec struct + func (c *ServerCodec) ReadBody(x interface{}) error + func (c *ServerCodec) ReadHeader(header map[string]string, body []byte) error + func (c *ServerCodec) Write(errMsg string, x interface{}) ([]byte, error)