summaryrefslogtreecommitdiff
path: root/tests/echo-client.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/echo-client.php')
-rw-r--r--tests/echo-client.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/echo-client.php b/tests/echo-client.php
new file mode 100644
index 00000000..22761862
--- /dev/null
+++ b/tests/echo-client.php
@@ -0,0 +1,20 @@
+<?php
+
+use Spiral\Goridge;
+use Spiral\RoadRunner;
+
+/**
+ * echo client over pipes.
+ */
+ini_set('display_errors', 'stderr');
+require "vendor/autoload.php";
+
+$rr = new RoadRunner\Worker(new Goridge\StreamRelay(STDIN, STDOUT));
+
+while ($in = $rr->receive($ctx)) {
+ try {
+ $rr->send((string)$in);
+ } catch (\Throwable $e) {
+ $rr->error((string)$e);
+ }
+} \ No newline at end of file