MCPcopy
hub / github.com/davyxu/cellnet / clientSyncRPC

Function clientSyncRPC

examples/echo/client_rpc_sync.go:11–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9)
10
11func clientSyncRPC() {
12
13 queue := cellnet.NewEventQueue()
14
15 p := peer.NewGenericPeer("tcp.Connector", "async rpc", peerAddress, queue)
16
17 // 创建一个消息同步接收器
18 rv := proc.NewSyncReceiver(p)
19
20 proc.BindProcessorHandler(p, "tcp.ltv", rv.EventCallback())
21
22 p.Start()
23
24 queue.StartLoop()
25
26 // 等连接上时
27 rv.WaitMessage("cellnet.SessionConnected")
28
29 // 同步RPC
30 rpc.CallSync(p, &TestEchoACK{
31 Msg: "hello",
32 Value: 1234,
33 }, time.Second)
34}

Callers 1

mainFunction · 0.85

Calls 9

EventCallbackMethod · 0.95
StartLoopMethod · 0.95
WaitMessageMethod · 0.95
NewEventQueueFunction · 0.92
NewGenericPeerFunction · 0.92
NewSyncReceiverFunction · 0.92
BindProcessorHandlerFunction · 0.92
CallSyncFunction · 0.92
StartMethod · 0.65

Tested by

no test coverage detected