summaryrefslogtreecommitdiff
path: root/plugins/server/tests/tcp.php
blob: c567c98213c4574430b94d3b587321f8fce52c19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
/**
 * @var Goridge\RelayInterface $relay
 */

use Spiral\Goridge;
use Spiral\RoadRunner;

require dirname(__DIR__) . "/../../tests/vendor/autoload.php";

$relay = new Goridge\SocketRelay("localhost", 9999);
$rr = new RoadRunner\Worker($relay);

while ($in = $rr->waitPayload()) {
    try {
        $rr->send((string)$in->body);
    } catch (\Throwable $e) {
        $rr->error((string)$e);
    }
}