-
Notifications
You must be signed in to change notification settings - Fork 784
升级到v2.0.6后 ws服务总是会自动将请求返回 #1002
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
Closed
Comments
swoft/websocket-server/src/WsMessageDispatcher.php 这个文件
把这个注释掉就不会自动返回了 控制器中的返回正常 |
@cirvor 你在message action 里怎么响应消息的呢? |
|
@cirvor 谢谢。 v2.0.6 有这个问题,自动响应时没有过滤空值。下个版本修复。 你在后面再加一句,防止再自动响应一次可以解决: context()->getResponse()->setSent(true); |
@inhere |
也可以这样替代现在的使用,就没问题: public function ping(): void
{
context()->getResponse()->setContent(json_encode([
'status' => 200,
'event' => 'PING',
'data' => 'PONG',
]));
}
// OR
public function ping(Response $response): void
{
$response->setContent(json_encode([
'status' => 200,
'event' => 'PING',
'data' => 'PONG',
]));
} |
我说怎么会出现错误,老铁搞死我了。 |
mark |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
第二个返回消息是框架自动返回的
且返回的请求数据中 data与ext的值都为空 说明获取到的请求数据并不完整
已回滚到2.0.5 一切正常
服务使用了使用了WsModule
请问有关闭的方法嘛?谢谢
The text was updated successfully, but these errors were encountered: