WIP Rimo outbound api client
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user