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.