hyperf / hyperf

🚀 A coroutine framework that focuses on hyperspeed and flexibility. Building microservice or middleware with ease.

Home Page:https://www.hyperf.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

tarople opened this issue · comments

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

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

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

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

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

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

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

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