MAPG-204 clean up result sending

This commit is contained in:
bence committed 2021-04-03 18:24:43 +02:00
1 parent 7433813337
commit 9e5d20796c
4 files changed
+72 -79

No files matched your search

+5 -3
View File
@@ -2,7 +2,7 @@
class MultiConnector
{
public function sendMessage(string $func, array $args = []): void
public function sendMessage(string $func, array $args = [])
{
$message = json_encode([
'func' => $func,
@@ -17,8 +17,10 @@ class MultiConnector
}
fclose($connection);
if ($response !== 'OK') {
throw new \Exception('Sending message failed with response: ' . $response);
$response = json_decode($response, true);
if (isset($response['data'])) {
return $response['data'];
}
}
}