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

swoole6 长链接群发问题请教 #5691

Open
LIngMax opened this issue Feb 21, 2025 · 0 comments
Open

swoole6 长链接群发问题请教 #5691

LIngMax opened this issue Feb 21, 2025 · 0 comments

Comments

@LIngMax
Copy link

LIngMax commented Feb 21, 2025

目前我了解的广播资料情况下:
SWOOLE_BASE 和 SWOOLE_THREAD 广播方式等同 要跨worker
所有长链接: 要群发或部分群体群发

连接进来要记录
1.记录worker_id
2.记录 fd连接序号

发送数据
1.定位发到对应worker_id
2.从worker下找到指定fd 发送

为了广播要维护长链接进来与离开的连接状态以及定位数据

而SWOOLE_PROCESS则比较简单(以上功能内置了)
优点1.任意task worker都可以用fd进行发送以及群发
优点2.代码更新后 $server->reload() 长链接也不用断开
缺点: 多进程不支持map共享变量


Swoole6多线程还有可能支持类似SWOOLE_PROCESS的方式吗
或者有更好的解决方案吗

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

1 participant