$con = new AsyncTcpConnection('wss://openspeech.bytedance.com:443/api/v2/asr');
$con->transport = 'ssl';
$con->onConnect = function(AsyncTcpConnection $con) {
$con->send('hello');
};
$con->onMessage = function(AsyncTcpConnection $con, $data) {
echo $data;
};
$con->connect();
workerman 版本3.5.34
php 版本 8.0.2
ws://openspeech.bytedance.com:443/api/v2/asr
把
$con = new AsyncTcpConnection('wss://openspeech.bytedance.com:443/api/v2/asr');
改成
$con = new AsyncTcpConnection('ws://openspeech.bytedance.com:443/api/v2/asr');
替换后 会报错 Call to a member function add() on null
workerman的类例如AsyncTcpConnection只能在workerman的运行环境使用。
workerman只支持php cli不支持php-fpm。