jsonrpcconn

package
v0.0.0-...-252b405 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package jsonrpcconn provides a way to multiplex an io stream into two streams where incoming JSON-RPC requests go to one stream and incoming JSON-RPC responses go to another. Outputs are merged.

The JSON-RPCv1 protocol is peer-to-peer, but the implementation in the Go standard library only supports client-server. By multiplexing a single io.ReadWriteCloser stream into separate server (receives requests) and client (receives responses) streams, two RPC halves can share the same underlying connection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientServerConn

func ClientServerConn(conn io.ReadWriteCloser) (clientConn io.ReadWriteCloser, serverConn io.ReadWriteCloser)

ClientServerConn multiplexes an input/output stream for the JSON-RPCv1 protocol into streams specific for client traffic and server traffic. Full JSON objects must be written atomically to either stream to interleave correctly.

func NewConn

func NewConn(rd io.ReadCloser, wr io.WriteCloser) io.ReadWriteCloser

NewConn returns a connection from a reader and a writer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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