$con = new AsyncTcpConnection('ws://****.com/随机字符串', $context_option);
$con->transport = 'ssl';
$con->onConnect = function($con) {
$con->send('hello');
};
$con->onMessage = function($con, $data) {
echo $data;
};
$con->onClose = function($con){
echo "connection closed\n";
Timer::add(5, array($con, 'connect'), null, false);
};
$con->connect();
触发onClose 的时候随机字符串有可能已经改变了 请问这时候应该怎么重连?
不要重复发帖子。
重新new吧,没办法