server

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Unlicense Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrThresholdExceeded = errors.New("stream size exceeds threshold")

Functions

func ContextWithPeerInfo

func ContextWithPeerInfo(ctx context.Context, c jsonrpc.PeerInfo) context.Context

func PeerInfoFromContext

func PeerInfoFromContext(ctx context.Context) jsonrpc.PeerInfo

PeerInfoFromContext returns information about the client's network connection. Use this with the context passed to RPC method handler functions.

The zero value is returned if no connection info is present in ctx.

Types

type Server

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

Server is an RPC server. it is in charge of calling the handler on the message object, the json encoding of responses, and dealing with batch semantics. a server can be used to listenandserve multiple codecs at a time

func NewServer

func NewServer(r jsonrpc.Handler) *Server

NewServer creates a new server instance with no registered handlers.

func (*Server) ServeCodec

func (s *Server) ServeCodec(ctx context.Context, remote jsonrpc.ReaderWriter) error

ServeCodec reads incoming requests from codec, calls the appropriate callback and writes the response back using the given codec. It will block until the codec is closed

func (*Server) Shutdown added in v0.3.9

func (s *Server) Shutdown(ctx context.Context)

type Writer added in v0.3.9

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

Writer wraps w with writing length limit.

To create Writer, use NewWriter().

func (*Writer) Write added in v0.3.9

func (lw *Writer) Write(p []byte) (n int, err error)

Writer implements io.Writer

Jump to

Keyboard shortcuts

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