From bc6304177666a03b835a40f9472591e93ccbc388 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Fri, 13 Oct 2023 11:32:05 +0200 Subject: [PATCH] WIP Rimo outbound api client --- bin/rimo-websocket-client-daemon.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/rimo-websocket-client-daemon.php b/bin/rimo-websocket-client-daemon.php index e9428c702..9fc7ae504 100755 --- a/bin/rimo-websocket-client-daemon.php +++ b/bin/rimo-websocket-client-daemon.php @@ -124,8 +124,9 @@ while($continue) { try { // open rimo websocket connection and process events //$continue = false; // don't fork again after child is done - $ws_timeout = 3600; - $ws = new WebSocket\Client(RIMO_API_WS_URL, ["timeout" => $ws_timeout]); + $ws_timeout = 10; + $ws_url = RIMO_API_WS_URL."?login=".RIMO_API_WS_USER."&passcode=".RIMO_API_WS_PASS; + $ws = new WebSocket\Client($ws_url, ["timeout" => $ws_timeout, "headers" => ["X-Api-Key" => RIMO_API_WS_PASS]]); $i = 0; while(1) { @@ -134,7 +135,7 @@ while($continue) { } $output = $ws->receive(); - client_log($mypid, "Received from websocktet: $output"); + client_log($mypid, "Received from websocket: $output"); sleep(1); $i++; } @@ -144,6 +145,7 @@ while($continue) { } catch (\Exception $e) { // exit child process on error client_log($mypid, "Caught exception: ".$e->getMessage(), "error"); + client_log($mypid); //$log->error("Caught exception: ".$e->getMessage()."\n"); exit; }