summaryrefslogtreecommitdiff
path: root/tests/plugins/server/socket.php
blob: 3159c445929362ba90203c321048b8e3e192b44c (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/autoload.php";

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

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

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