From 7ccacbfca839c1636adc705bb466e807920012cd Mon Sep 17 00:00:00 2001 From: Daniel Neto Date: Sun, 30 Jun 2024 20:01:35 -0300 Subject: [PATCH] Update --- plugin/YPTSocket/test.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/plugin/YPTSocket/test.php b/plugin/YPTSocket/test.php index 7adc7b5bd489..ebc3a367423f 100644 --- a/plugin/YPTSocket/test.php +++ b/plugin/YPTSocket/test.php @@ -94,12 +94,17 @@ function _test_send($SocketURL, $msg) { global $SocketSendObj; $conn->on('message', function($msg) use ($conn, $_count) { global $responses; - $json = _json_decode($msg->getPayload()); + $payload = $msg->getPayload(); + $json = _json_decode($payload); //var_dump($json); - $parts = explode(':', $json->msg->test_msg); - $c = new AVideoSocketConfiguration($parts[0], $parts[2], $parts[1], true); - $responses[] = $c; - $c->log(); + if(!empty($json->msg) && !is_object($json->msg)){ + $parts = explode(':', $json->msg->test_msg); + $c = new AVideoSocketConfiguration($parts[0], $parts[2], $parts[1], true); + $responses[] = $c; + $c->log(); + }else{ + $responses[] = "Could not decode response {$payload}"; + } printIfComplete(); });