server

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Unlicense Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultServer = &Server{}

Functions

func ContextWithMessageStream

func ContextWithMessageStream(ctx context.Context, c *jsonrpc.MessageStream) context.Context

func ContextWithPeerInfo

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

func MessageStreamFromContext

func MessageStreamFromContext(ctx context.Context) *jsonrpc.MessageStream

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.

func ServeCodec

func ServeCodec(ctx context.Context, remote jsonrpc.ReaderWriter, handler jsonrpc.Handler) error

Types

type Server

type Server struct {
	// allow concurrent batch requests
	BatchParallel bool
	BatchLimit    int
}

func (*Server) ServeCodec

func (s *Server) ServeCodec(ctx context.Context, remote jsonrpc.ReaderWriter, handler jsonrpc.Handler) 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. the codec will return if either of these conditions are met 1. every request read from ReadBatch until ReadBatch returns context.Canceled is processed. 2. there is a server related error (failed encoding, broken conn) that was received while processing/reading messages.

Jump to

Keyboard shortcuts

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