top-think/think-worker

onConnect中无法推送消息

Opened this issue · 1 comments

public function onConnect($connection)
    {
        echo "new connection from ip " . $connection->getRemoteIp() . "\n";
        $connection->send('receive success');
    }
    public function onMessage($connection, $data)
    {
         $connection->send($data);
    }

onMessage可以发送消息;onConnect无法推送消息,但是在客户端cli可以打印IP

$connection 有哪些可以调用的方法