Your software version (Screenshot of your startup)
Software
Version
PHP
8.0.26
Swoole
5.0.1
Laravel/Lumen
8.83.26
Detail description about this issue(error/log)
1: ✘ ykxiao@ip-192-168-43-20 ~ telnet 127.0.0.1 5291
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Welcome to cusService.
2:监听TCP后,在控制器推送消息时提示:"Swoole\WebSocket\Server::push(): the connected client of connection[2] is not a websocket client or closed"
Some reproducible code blocks and steps
use Swoole\WebSocket\Server;
/**
* @return JsonResponse
*/
public function tcpTest(): JsonResponse
{
/**@var \Swoole\Http\Server|Server $swoole */
$swoole = app('swoole');
$port = $swoole->ports[1];
foreach ($port->connections as $fd) {
if ($swoole->isEstablished($fd)) {
$swoole->push($fd, 'Send TCP message');
}
}
return $this->response->success();
}
Your software version (Screenshot of your startup)
Detail description about this issue(error/log)
1: ✘ ykxiao@ip-192-168-43-20 ~ telnet 127.0.0.1 5291 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Welcome to cusService. 2:监听TCP后,在控制器推送消息时提示:"Swoole\WebSocket\Server::push(): the connected client of connection[2] is not a websocket client or closed"
Some
reproducible
code blocks andsteps