egg icon indicating copy to clipboard operation
egg copied to clipboard

egg-socket dev环境使用只有启动的客户端访问能进入connect

Open shaojun427 opened this issue 7 years ago • 2 comments

本机dev启动 访问是正常的,局域网另一台机子访问http都是正常的,访问ws接口 进不到connectionMiddleware,也进不去controller,但是本机访问什么都是正常的。还有http接口获取ctx.ip都是对的,但是本机获取ws.ip都是::1,不知道是少了什么配置吗。

node:10.15.1 egg:2.15.1 egg-socket: 4.1.5

shaojun427 avatar Apr 30 '19 04:04 shaojun427

Hello @shaojun427. Please provide a reproducible example following the instruction.

Issues labeled by Need Reproduce will be closed if no activities in 7 days.


@shaojun427,请根据这个说明提供最小可复现代码。

如果在 7 天内没有进展会被自动关闭。

egg-bot avatar Apr 30 '19 05:04 egg-bot

应该是 listen: { port: 80, hostname: '0.0.0.0', } hostname只对http的有效果,对ws的没有效果,因为局域网其他ip的客户端的ws接口都连不上

shaojun427 avatar Apr 30 '19 06:04 shaojun427