You've already forked qlg.tsgz.moe
addons
app_download_files
extend
hyhproject
mobile
oss
static
thinkphp
upload
vendor
5ini99
composer
oss-sdk
swoole
.github
benchmark
examples
include
src
tests
include
swoole_async
swoole_atomic
swoole_buffer
swoole_channel
swoole_client_async
swoole_client_coro
swoole_client_sync
swoole_coroutine
swoole_coroutine_channel
swoole_coroutine_util
swoole_event
swoole_function
swoole_http2_client
swoole_http2_client_coro
swoole_http_cilent_coro
swoole_http_client
connect_host_not_found.phpt
connect_port_not_listen.phpt
content_length.phpt
cookie.phpt
download.phpt
execute_without_method_and_content.phpt
get.phpt
get_with_query_string.phpt
get_without_query_string.phpt
http_proxy.phpt
http_request_connect_timeout.phpt
keepalive.phpt
method_delete.phpt
method_delete_with_payload.phpt
method_get.phpt
method_get_with_payload.phpt
method_head.phpt
method_patch.phpt
method_patch_with_payload.phpt
method_post.phpt
method_post_with_payload.phpt
method_put.phpt
method_put_with_payload.phpt
post.phpt
post_with_body.phpt
post_with_empty_content.phpt
post_without_content_length.phpt
recursive_get.phpt
request_timeout.phpt
set_cookie_zval.phpt
set_headers_core1.phpt
set_headers_core2.phpt
test_big_body.phpt
test_cookie.phpt
test_header.phpt
test_header_core.phpt
test_request.phpt
test_twice_send.phpt
test_uri.phpt
timeout.phpt
upload.phpt
websocket.phpt
websocket_bad_protocol.phpt
websocket_bug_18031401.phpt
websocket_port_not_listen.phpt
swoole_http_server
swoole_https_client
swoole_lock
swoole_memory_pool
swoole_mysql
swoole_mysql_coro
swoole_process
swoole_redis
swoole_redis_coro
swoole_redis_server
swoole_serialize
swoole_server
swoole_server_port
swoole_socket_coro
swoole_table
swoole_timer
swoole_websocket_server
CONTRIBUTION
README.md
clean
coro_test.sh
new.sh
run-tests
start.sh
template.phpt
test-all-version.sh
test.sql
thirdparty
tools
travis
.gitignore
.gitmodules
.travis.yml
CMakeLists.txt
CREDITS
LICENSE
README.md
Version2.md
build.sh
clear.sh
config.m4
make.sh
package.xml
php7_wrapper.h
php_swoole.h
swoole.c
swoole_async.c
swoole_atomic.c
swoole_buffer.c
swoole_channel.c
swoole_channel_coro.cc
swoole_client.c
swoole_client_coro.c
swoole_config.h
swoole_coroutine.cc
swoole_coroutine.h
swoole_coroutine_util.c
swoole_event.c
swoole_http.h
swoole_http_client.c
swoole_http_client.h
swoole_http_client_coro.c
swoole_http_server.c
swoole_http_v2_client.c
swoole_http_v2_client.h
swoole_http_v2_client_coro.c
swoole_http_v2_server.c
swoole_lock.c
swoole_memory_pool.c
swoole_mmap.c
swoole_msgqueue.c
swoole_mysql.c
swoole_mysql.h
swoole_mysql_coro.c
swoole_postgresql_coro.c
swoole_postgresql_coro.h
swoole_process.c
swoole_process_pool.c
swoole_redis.c
swoole_redis_coro.c
swoole_redis_server.c
swoole_ringqueue.c
swoole_runtime.cc
swoole_serialize.c
swoole_serialize.h
swoole_server.c
swoole_server_port.c
swoole_socket_coro.c
swoole_table.c
swoole_timer.c
swoole_trace.c
swoole_websocket_server.c
wechat
.htaccess
autoload.php
wxtmp
.gitignore
.htaccess
.user.ini
404.html
H5436787D.wgt
admin.php
app-release.apk
app_download.html
cash.lock
demo.php
get_startup.php
get_version.php
get_version_new.php
index.html
index.php
reg.lock
robots.txt
82 lines
1.8 KiB
PHP
Executable File
82 lines
1.8 KiB
PHP
Executable File
--TEST--
|
|
swoole_http_client: websocket client send 128 messages
|
|
--SKIPIF--
|
|
<?php require __DIR__ . '/../include/skipif.inc'; ?>
|
|
--FILE--
|
|
<?php
|
|
require_once __DIR__ . '/../include/bootstrap.php';
|
|
require_once __DIR__ . '/../include/swoole.inc';
|
|
const N = 128;
|
|
$pm = new ProcessManager;
|
|
$pm->parentFunc = function ($pid)
|
|
{
|
|
$cli = new swoole_http_client('127.0.0.1', 9501);
|
|
$cli->count = 0;
|
|
$cli->on('close', function ($cli)
|
|
{
|
|
echo "close\n";
|
|
});
|
|
$cli->on('error', function ($cli)
|
|
{
|
|
echo "error\n";
|
|
});
|
|
$cli->on('Message', function ($cli, $frame)
|
|
{
|
|
$cli->count++;
|
|
if ($cli->count == N)
|
|
{
|
|
echo "OK\n";
|
|
$cli->close();
|
|
}
|
|
});
|
|
$cli->upgrade('/websocket', function ($cli)
|
|
{
|
|
for ($i = 0; $i < N; $i++)
|
|
{
|
|
$cli->push(str_repeat('A', rand(8192, 65536)));
|
|
}
|
|
});
|
|
swoole_event::wait();
|
|
swoole_process::kill($pid);
|
|
};
|
|
|
|
$pm->childFunc = function () use ($pm)
|
|
{
|
|
$serv = new swoole_websocket_server("127.0.0.1", 9501);
|
|
$serv->set(['log_file' => '/dev/null']);
|
|
$serv->count = 0;
|
|
$serv->on('Open', function ($swoole_server, $req)
|
|
{
|
|
});
|
|
$serv->on("WorkerStart", function (\swoole_server $serv)
|
|
{
|
|
/**
|
|
* @var $pm ProcessManager
|
|
*/
|
|
global $pm;
|
|
$pm->wakeup();
|
|
});
|
|
$serv->on('Message', function ($serv, $frame)
|
|
{
|
|
$serv->count++;
|
|
if ($serv->count == N)
|
|
{
|
|
for ($i = 0; $i < N; $i++)
|
|
{
|
|
$serv->push($frame->fd, str_repeat('B', rand(8192, 65536)));
|
|
}
|
|
}
|
|
});
|
|
$serv->on('Close', function ($swoole_server, $fd)
|
|
{
|
|
});
|
|
$serv->start();
|
|
};
|
|
|
|
$pm->childFirst();
|
|
$pm->run();
|
|
?>
|
|
--EXPECT--
|
|
OK
|
|
close
|