2.0 从github上面下载的代码运行报错
发布于 3 个月前 作者 baiguo 423 次浏览 来自 问答

启动之后,访问客户端网页聊天版本 http://127.0.0.1:8080/mqant/chat/index.html 一直报错说 Service(type:Login) not found

访问小球碰撞游戏DEMO 一直黑屏

4 回复

这段代码有点问题,注释掉就可以了 //app.Options().Selector.Init(selector.SetStrategy(func(services []*registry.Service) selector.Next{ // var nodes []*registry.Node // // // Filter the nodes for datacenter // for _, service := range services { // for _, node := range service.Nodes { // if node.Metadata[“type”] == “helloworld” { // nodes = append(nodes, node) // } // } // } // // var mtx sync.Mutex // //log.Info(“services[0] $v”,services[0].Nodes[0]) // return func() (*registry.Node, error) { // mtx.Lock() // defer mtx.Unlock() // if len(nodes)==0{ // return nil,fmt.Errorf(“no node”) // } // index := rand.Intn(int(len(nodes))) // return nodes[index], nil // } //}))

更新一下mqantserver工程就行了

同样遇到了这个问题,我是2019-06-28 拉的代码 注掉了你上面说的那段,仍然是登陆聊天室(用户:mqant 房间:mqant)页面上报 Service(type:Login) not found;hitball 黑屏

server日志如下: root@kali:~/work/mqantserver# ./bin/server --conf bin/conf/server.json --log bin/logs 2019-06-28T08:21:29.959509999-04:00 [-] [-] [] [E] nats agent: nats: no servers available for connection Server configuration path : bin/conf/server.json 2019-06-28T08:21:29.96047587-04:00 [-] [-] [development] [I] [app.go:190] mqant starting up 2019-06-28T08:21:29.960514538-04:00 [-] [-] [development] [I] [ModuleManager.go:50] This service ProcessID is [development] 2019-06-28T08:21:29.960547802-04:00 [-] [-] [development] [I] [rpc_server.go:142] Registering node: Master@f071c74674b4f894 2019-06-28T08:21:29.9632326-04:00 [-] [-] [development] [I] [rpc_server.go:142] Registering node: Hitball@6775c80d4dad5557 2019-06-28T08:21:29.963425311-04:00 [-] [-] [development] [I] [rpc_server.go:142] Registering node: Master@f071c74674b4f894 2019-06-28T08:21:29.968585258-04:00 [-] [-] [development] [I] [rpc_server.go:142] Registering node: Gate@23c0b79eea18e43b 2019-06-28T08:21:29.969220893-04:00 [-] [-] [development] [I] [rpc_server.go:142] Registering node: Hitball@6775c80d4dad5557 2019-06-28T08:21:29.970569276-04:00 [-] [-] [development] [I] [rpc_server.go:142] Registering node: HelloWorld@bfbe25297fe71a5f 2019-06-28T08:21:29.970917141-04:00 [-] [-] [development] [I] [rpc_server.go:142] Registering node: Gate@23c0b79eea18e43b 2019-06-28T08:21:29.971540258-04:00 [-] [-] [development] [I] [ws_server.go:117] WS Listen ::3653 2019-06-28T08:21:29.971595243-04:00 [-] [-] [development] [I] [tcp_server.go:39] TCP Listen ::3563 2019-06-28T08:21:29.971645184-04:00 [-] [-] [development] [I] [rpc_server.go:142] Registering node: Login@08eaf19aa75b26c3 2019-06-28T08:21:29.973205621-04:00 [-] [-] [development] [I] [rpc_server.go:142] Registering node: HelloWorld@bfbe25297fe71a5f 2019-06-28T08:21:29.97418717-04:00 [-] [-] [development] [I] [rpc_server.go:142] Registering node: Chat@83f22bd429d3cc9c 2019-06-28T08:21:29.974764683-04:00 [-] [-] [development] [I] [rpc_server.go:142] Registering node: Login@08eaf19aa75b26c3 2019-06-28T08:21:29.975527835-04:00 [-] [-] [development] [I] [rpc_server.go:142] Registering node: Webapp@3d6f65d98f28ff13 2019-06-28T08:21:29.975990981-04:00 [-] [-] [development] [I] [rpc_server.go:142] Registering node: Chat@83f22bd429d3cc9c 2019-06-28T08:21:29.976516657-04:00 [-] [-] [development] [I] [rpc_server.go:142] Registering node: XaXb@b8206b0f19456efc 2019-06-28T08:21:29.977572249-04:00 [-] [-] [development] [I] [rpc_server.go:142] Registering node: Webapp@3d6f65d98f28ff13 2019-06-28T08:21:29.978355032-04:00 [-] [-] [development] [I] [module.go:60] webapp server Listen : :8080 2019-06-28T08:21:29.979747295-04:00 [-] [-] [development] [I] [rpc_server.go:142] Registering node: XaXb@b8206b0f19456efc 2019-06-28T08:21:34.779699721-04:00 [-] [-] [development] [W] [cache.go:288] result chan closed github.com/liangdas/mqant/selector/cache/cache.go:288 runtime/asm_amd64.s:1333 2019-06-28T08:21:34.779716636-04:00 [-] [-] [development] [W] [cache.go:288] result chan closed github.com/liangdas/mqant/selector/cache/cache.go:288 runtime/asm_amd64.s:1333 2019-06-28T08:21:34.779724508-04:00 [-] [-] [development] [W] [cache.go:288] result chan closed github.com/liangdas/mqant/selector/cache/cache.go:288 runtime/asm_amd64.s:1333 2019/06/28 08:21:34 [ERR] consul.watch: Watch (type: services) errored: Get http://127.0.0.1:8500/v1/catalog/services: dial tcp 127.0.0.1:8500: connect: connection refused, retry in 5s 2019/06/28 08:21:39 [ERR] consul.watch: Watch (type: services) errored: Get http://127.0.0.1:8500/v1/catalog/services: dial tcp 127.0.0.1:8500: connect: connection refused, retry in 20s

@liangdas 看你git 记录是注掉了 又解回来 啥情况

回到顶部