diff --git a/src/Multi/MultiConnector.php b/src/Multi/MultiConnector.php new file mode 100644 index 0000000..d74535e --- /dev/null +++ b/src/Multi/MultiConnector.php @@ -0,0 +1,24 @@ + $func, + 'args' => $args + ]); + + $connection = fsockopen($_ENV['MULTI_INTERNAL_HOST'], $_ENV['MULTI_INTERNAL_PORT']); + fwrite($connection, $message); + $response = ''; + while (!feof($connection)) { + $response .= fgets($connection); + } + fclose($connection); + + if ($response !== 'OK') { + throw new \Exception('Sending message failed with response: ' . $response); + } + } +}