<commit_before>--TEST--
swoole_websocket_server: websocket push 2
--SKIPIF--
<?php require __DIR__ . '/../include/skipif.inc'; ?>
--INI--
assert.active=1
assert.warning=1
assert.bail=0
assert.quiet_eval=0

--FILE--
<?php
require_once __DIR__ . '/../include/bootstrap.php';
require __DIR__ . '/../include/swoole.inc';
require __DIR__ . '/../include/lib/class.websocket_client.php';

function start_swoole_ws_server()
{
    swoole_php_fork(function ()
    {
        $serv = new swoole_websocket_server("127.0.0.1", 9501);
        $serv->set(['log_file' => '/dev/null']);
        $serv->on('Open', function ($swoole_server, $req)
        {
        });

        $serv->on('Message', function ($swoole_server, $frame)
        {
            $swoole_server->push($frame->fd, "hello " . $frame->data);
        });

        $serv->on('Close', function ($swoole_server, $fd)
        {
        });

        $serv->start();
    });
}
sleep(1);	//wait the release of port 9501
start_swoole_ws_server();
sleep(1);

$cli = new WebsocketClient;
$connected = $cli->connect('127.0.0.1', 9501, '/');
echo $cli->checkConnection(),"\n";
?>
Done
--EXPECTREGEX--
1
Done.*
--CLEAN--<commit_msg>Improve ping pong test, swoole websocket client support send ping frame and recv pong frame.<commit_after>--TEST--
swoole_websocket_server: websocket push 2
--SKIPIF--
<?php require __DIR__ . '/../include/skipif.inc'; ?>
--FILE--
<?php
require_once __DIR__ . '/../include/bootstrap.php';
$pm = new ProcessManager;
$pm->parentFunc = function (int $pid) use ($pm) {
    go(function () use ($pm) {
        $cli = new \Swoole\Coroutine\Http\Client('127.0.0.1', $pm->getFreePort());
        $cli->set(['timeout' => 1]);
        $ret = $cli->upgrade('/');
        assert($ret);
        for ($i = 100; $i--;)
        {
            $ping = new swoole_websocket_frame;
            $ping->opcode = WEBSOCKET_OPCODE_PING;
            $ret = $cli->push($ping);
            assert($ret);
            $pong = $cli->recv();
            assert($pong->opcode == WEBSOCKET_OPCODE_PONG);
        }
        $pm->kill();
    });
    swoole_event_wait();
};
$pm->childFunc = function () use ($pm) {
    $serv = new swoole_websocket_server("127.0.0.1", $pm->getFreePort());
    $serv->set([
        'worker_num' => 1,
        'log_file' => '/dev/null'
    ]);
    $serv->on('workerStart', function () use ($pm) {
        $pm->wakeup();
    });
    $serv->on('open', function ($swoole_server, $req) { });
    $serv->on('message', function ($swoole_server, $frame) { });
    $serv->on('close', function ($swoole_server, $fd) { });
    $serv->start();
};
$pm->childFirst();
$pm->run();
?>
--EXPECT--
{'fraction_non_alphanumeric': 0.20998864926220204, 'fraction_numerical': 0.018917896329928113, 'mean_word_length': 2.677329624478442, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3215348', 'n_tokens_mistral': 972, 'n_tokens_neox': 938, 'n_words': 174}