eggjs / eggjs/egg

egg-socket.io 在默认命名空间中的 异常和不合理的行为

Open
#4,311 1 comment 0 reactions 1 assignee Claimed by @ngot View on GitHub
Inactive
Dominant language
TypeScript
Stars
19k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

平台:
server:
"egg": "^2.15.1",
"egg-scripts": "^2.11.0",
"egg-socket.io": "^4.1.6"
client:
"socket.io-client": "^2.2.0"

自定义命名空间在配置了默认命名空间 '/' 情况下
![image](https://user-images.githubusercontent.com/43066752/82173781-0704e600-9901-11ea-922b-6a4e49c31861.png)
客户端创建两条连接时(非默认命名空间)如下
![image](https://user-images.githubusercontent.com/43066752/82173905-7aa6f300-9901-11ea-9dfa-9ae46f302143.png)
![image](https://user-images.githubusercontent.com/43066752/82173920-88f50f00-9901-11ea-8595-07c97db74061.png)

非默认命名空间的连接 会通过 默认命名空间(‘/’)的中间件 并创建 与 当前连接 相同的id的 socket 进程并会 非法获取 非默认命名空间的参数

![image](https://user-images.githubusercontent.com/43066752/82174511-85fb1e00-9903-11ea-99ff-f23a475a3502.png)

但是在去除默认命名空间的 配置后就会正常。

总结:在配置了默认的命名空间的情况下 默认命名空间 会非法捕获 其他命名空间的连接 并创建相同id的socket 进程,次默认行为会占用双倍资源和 不合理的 行为,期望修复。

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.