Watch 1 Star 0 Fork 0

小滕 / swoole-base

Sign up for free
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
Nothing here. spread retract

Clone or download
test.php 670 Bytes
Copy Edit Web IDE Raw Blame History
Xiaoteng authored 2019-04-14 17:09 . first
<?php
use Swoole\Coroutine\Client;
$num = 100;
while ($num-- > 0) {
go(function () {
$client = new Client(SWOOLE_SOCK_TCP);
$client->connect('127.0.0.1', 9501, 0.5);
$client->send("GET /connect HTTP/1.1" . "\r\n" .
"Origin: localhost" . "\r\n" .
"Host: localhost:9501" . "\r\n" .
"Sec-WebSocket-Key: ". base64_encode('asdasdzxcad1sa') . "\r\n" .
"User-Agent: PHPWebSocketClient/0.1.4\r\n" .
"Upgrade: websocket" . "\r\n" .
"Connection: Upgrade" . "\r\n" .
"Sec-WebSocket-Protocol: wamp" . "\r\n" .
"Sec-WebSocket-Version: 13" . "\r\n" . "\r\n");
$client->recv();
$client->close();
});
}

Comment ( 0 )

You need to Sign in for post a comment

1
https://gitee.com/myteng/swoole-base.git
git@gitee.com:myteng/swoole-base.git

Help Search