Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在 Leaf 中如何与HTTP服务器通讯 #39

Closed
heyuanchao opened this issue Mar 3, 2017 · 6 comments
Closed

在 Leaf 中如何与HTTP服务器通讯 #39

heyuanchao opened this issue Mar 3, 2017 · 6 comments

Comments

@heyuanchao
Copy link

比如我要接入微信支付、支付宝,要访问一些http/https的接口,是直接用Go提供的net/http包吗?

@name5566
Copy link
Owner

name5566 commented Mar 3, 2017

可以使用 Go 的 net/http 包并使用 ChanRPC 进行通讯。

@fireice009
Copy link

fireice009 commented Apr 7, 2017

@name5566
http.ListenAndServe 能否放在Module 里面执行?发现这样会阻塞后续的流程。即使放到 leaf.Run 的最后一个参数。TCP 服务应该是在 Module 加载起来后才启动的吧?
还是说要用 skeleton.Go 来执行?会不会有什么坑?
在 main.go 里面执行也不行,因为 leaf.Run 后会阻塞。

@name5566
Copy link
Owner

独立启动一个 goroutine 进行 ListenAndServe,不要用 skeleton.Go 来创建这个独立的 goroutine

@chiuan
Copy link

chiuan commented Apr 10, 2017

可以出一个http_network

@heyuanchao
Copy link
Author

@name5566 现在需要使用 Leaf 做一个管理后台,在 game 模块的什么地方启动 一个独立的 goroutine 进行 http.ListenAndServe 才比较好?

@15951836388
Copy link

不知道用发送http给leaf的conslo,来实现gm行不行?
https://github.com/name5566/leaf/wiki/Leaf-console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants