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

协程风格websocket服务不能同时处理http请求吗? #6741

Closed
tarople opened this issue May 9, 2024 · 4 comments
Closed

协程风格websocket服务不能同时处理http请求吗? #6741

tarople opened this issue May 9, 2024 · 4 comments
Labels
question Further information is requested

Comments

@tarople
Copy link

tarople commented May 9, 2024

WX20240509-185316@2x
WX20240509-185352@2x

ws://127.0.0.1:9503/ws 这个可以正常链接
http://127.0.0.1:9503/hello 无法访问

@tarople tarople added the question Further information is requested label May 9, 2024
@lazychanger
Copy link
Contributor

可以,hyperf文档里面有 在 WebSocket 服务中处理 HTTP 请求

@tarople
Copy link
Author

tarople commented May 10, 2024

可以,hyperf文档里面有 在 WebSocket 服务中处理 HTTP 请求

我试了,这个不设置 'type' => CoroutineServer::class才可以

@limingxinleo
Copy link
Member

不能,协程风格没有做这个处理,不过理论上可以实现

@limingxinleo
Copy link
Member

像你这种情况,真心建议多监听一个 server 专门处理 http 请求。

或者上级 Nginx 直接分流就行了

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

No branches or pull requests

3 participants