jsonrpc

package module
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2019 License: MIT Imports: 8 Imported by: 0

README

JSON-RPC protocol library

Codecov Build Status Report GitHub release GitHub

Documentation

Index

Constants

View Source
const (
	//ErrNotAFunction when passed not a function
	ErrNotAFunction = Error("method must be function")
	//ErrNotEnoughArgs when passed less than three args
	ErrNotEnoughArgs = Error("method needs three args: *http.Request, *args, *reply")
	//ErrNotEnoughOut when method has not output
	ErrNotEnoughOut = Error("method needs one out: error")
	//ErrNotReturnError when method out is not error
	ErrNotReturnError = Error("method needs one out: error")
	//ErrFirstArgRequest when first arg is not *http.Request
	ErrFirstArgRequest = Error("method needs first parameter to be *http.Request")
	//ErrSecondArgError when 2nd arg is not pointer or not exported
	ErrSecondArgError = Error("second argument must be a pointer and must be exported")
	//ErrThirdArgError when 3rd arf is not pointer or not exported
	ErrThirdArgError = Error("third argument must be a pointer and must be exported")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CompressionSelector added in v1.3.0

type CompressionSelector = codec.CompressionSelector

CompressionSelector alias

type Error added in v1.3.0

type Error string

Error is constant error

func (Error) Error added in v1.3.0

func (e Error) Error() string

type RPC added in v1.3.0

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

RPC server struct

func NewRPC added in v1.3.0

func NewRPC() *RPC

NewRPC create new server instance

func (*RPC) AddCodec added in v1.3.0

func (s *RPC) AddCodec(codec codec.Interface, mime string)

AddCodec register codec

func (*RPC) AddMethod added in v1.3.0

func (s *RPC) AddMethod(name string, fn interface{}) error

AddMethod register method func(r *http.Request, args interface{}, reply *Reply) error

func (*RPC) ServeHTTP added in v1.3.0

func (s *RPC) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implementation of http.Handler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL