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

use Spiral\Goridge;
use Spiral\RoadRunner;

require dirname(__DIR__) . "/../../vendor_php/autoload.php";

$relay = new Goridge\SocketRelay(
            "unix.sock",
            null,
            Goridge\SocketRelay::SOCK_UNIX
        );

$rr = new RoadRunner\Worker($relay);

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