MCPcopy Create free account
hub / github.com/CPChain/chain / DialInProc

Function DialInProc

api/rpc/inproc.go:25–33  ·  view source on GitHub ↗

DialInProc attaches an in-process connection to the given RPC server.

(handler *Server)

Source from the content-addressed store, hash-verified

23
24// DialInProc attaches an in-process connection to the given RPC server.
25func DialInProc(handler *Server) *Client {
26 initctx := context.Background()
27 c, _ := newClient(initctx, func(context.Context) (net.Conn, error) {
28 p1, p2 := net.Pipe()
29 go handler.ServeCodec(NewJSONCodec(p1), OptionMethodInvocation|OptionSubscriptions)
30 return p2, nil
31 })
32 return c
33}

Callers 7

TestClientRequestFunction · 0.85
TestClientBatchRequestFunction · 0.85
TestClientSubscribeFunction · 0.85
TestClientSubscribeCloseFunction · 0.85

Calls 3

newClientFunction · 0.85
NewJSONCodecFunction · 0.85
ServeCodecMethod · 0.80

Tested by 7

TestClientRequestFunction · 0.68
TestClientBatchRequestFunction · 0.68
TestClientSubscribeFunction · 0.68
TestClientSubscribeCloseFunction · 0.68