Skip to content

Latest commit

 

History

History
139 lines (132 loc) · 3.18 KB

README.md

File metadata and controls

139 lines (132 loc) · 3.18 KB

多路复用组件

安装

composer require mix-plus/rpc-multiplex

测试

# 客户端
$max = 100;
    go(function () use ($max) {
        $client = new Client('127.0.0.1', 9601);
        for ($i = 0; $i < $max; ++$i) {
            go(function () use ($client) {
                $client->request('World.');
            });
        }
    });
# 服务端
go(function () {
    $server = new Server();
    $config = [];
    echo 'swoole server running...';
    $server->bind('0.0.0.0', 9601, $config)->handle(static function (Packet $packet) {
        var_dump('hello' . $packet->getBody());
    })->start();
});

结果

swoole server running...string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."
string(11) "helloWorld."

LICENSE

Apache License Version 2.0, http://www.apache.org/licenses/