public function websocketClient()
    {
        $this->writeln('Starting demo websocket client...');

        $client = new Client(
            'ws://' .
            ($this->swooleConfig['ws']['host'] ?? self::DEFAULT_SWOOLE_HOST) . ':' .
            ($this->swooleConfig['ws']['port'] ?? self::DEFAULT_SWOOLE_PORT)
        );
        $client->send(JsonHelper::encode(['handler' => SwooleTcpJob::class]));
        $this->writeln($client->receive());
        $client->close();
    }
public function websocketClient()
    {
        $this->writeln('Starting demo websocket client...');

        $client = new Client(
            'ws://' .
            ($this->swooleConfig['ws']['host'] ?? self::DEFAULT_SWOOLE_HOST) . ':' .
            ($this->swooleConfig['ws']['port'] ?? self::DEFAULT_SWOOLE_PORT)
        );
        $client->send(JsonHelper::encode(['handler' => SwooleTcpJob::class]));
        $this->writeln($client->receive());
        $client->close();
    }
public function websocketClient ( ) { $ this -> writeln ( 'Starting demo websocket client...' ) ; $ client = new Client ( 'ws://' . ( $ this -> swooleConfig [ 'ws' ] [ 'host' ] ?? self :: DEFAULT_SWOOLE_HOST ) . ':' . ( $ this -> swooleConfig [ 'ws' ] [ 'port' ] ?? self :: DEFAULT_SWOOLE_PORT ) ) ; $ client -> send ( JsonHelper :: encode ( [ 'handler' => SwooleTcpJob :: class ] ) ) ; $ this -> writeln ( $ client -> receive ( ) ) ; $ client -> close ( ) ; }
Websocket Client Demo
Websocket Client Demo