jsonrpcfx

package
v0.1.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Provide(New)

Module is an fx module to handle JSON-RPC requests.

Functions

This section is empty.

Types

type ConnectionManager

type ConnectionManager interface {
	NewConnection(ctx context.Context, conn *jsonrpc2.Conn) (router Router, err error)
	RemoveConnection(ctx context.Context, id uuid.UUID)
}

ConnectionManager will manage each active connection and its corresponding Router throughout the lifecycle of a connection.

type JSONRPCModule

type JSONRPCModule interface {
	OnStart(ctx context.Context) error
	ServeStream(ctx context.Context, conn jsonrpc2.Conn) error
	RegisterConnectionManager(connectionManager ConnectionManager) error
}

JSONRPCModule represents a module to manage JSON-RPC requests.

func New

func New(p Params) (JSONRPCModule, error)

New creates a new server to handle JSON-RPC requests on the given port and host.

type Params

type Params struct {
	fx.In

	Config         config.Provider
	Lifecycle      fx.Lifecycle
	Logger         *zap.SugaredLogger
	ServerInfoFile serverinfofile.ServerInfoFile
}

Params define values to be used by JsonRpcHandler.

type Router

type Router interface {
	HandleReq(ctx context.Context, reply jsonrpc2.Replier, req jsonrpc2.Request) error
	UUID() uuid.UUID
}

Router serves as the interface through which handling of requests will be implemented.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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