func client() { pipe := cellnet.NewEventPipe() p := socket.NewConnector(pipe) p.SetName("client") p.Start("127.0.0.1:9201") socket.RegisterSessionMessage(p, "gamedef.SessionConnected", func(content interface{}, ses cellnet.Session) { rpc.Call(p, &gamedef.TestEchoACK{ Content: "rpc async call", }, func(msg *gamedef.TestEchoACK) { log.Debugln("client recv", msg.Content) signal.Done(1) }) }) pipe.Start() signal.WaitAndExpect(1, "not recv data") }
func client() { pipe := cellnet.NewEventPipe() p := socket.NewConnector(pipe).Start("127.0.0.1:7201") rpc.InstallClient(p) socket.RegisterSessionMessage(p, coredef.SessionConnected{}, func(content interface{}, ses cellnet.Session) { rpc.Call(p, &coredef.TestEchoACK{ Content: "rpc hello", }, func(msg *coredef.TestEchoACK) { log.Debugln("client recv", msg.Content) signal.Done(1) }) }) pipe.Start() signal.WaitAndExpect(1, "not recv data") }
func client() { pipe := cellnet.NewEventPipe() p := socket.NewConnector(pipe).Start("127.0.0.1:7234") rpc.InstallClient(p) socket.RegisterSessionMessage(p, coredef.SessionConnected{}, func(content interface{}, ses cellnet.Session) { rpc.Call(p, &coredef.TestEchoACK{ Content: proto.String("rpc hello"), }, func(msg *coredef.TestEchoACK) { log.Println("client recv", msg.GetContent()) done <- true }) }) pipe.Start() }