WIP Rimo outbound api client
This commit is contained in:
@@ -124,8 +124,9 @@ while($continue) {
|
|||||||
try {
|
try {
|
||||||
// open rimo websocket connection and process events
|
// open rimo websocket connection and process events
|
||||||
//$continue = false; // don't fork again after child is done
|
//$continue = false; // don't fork again after child is done
|
||||||
$ws_timeout = 3600;
|
$ws_timeout = 10;
|
||||||
$ws = new WebSocket\Client(RIMO_API_WS_URL, ["timeout" => $ws_timeout]);
|
$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;
|
$i = 0;
|
||||||
while(1) {
|
while(1) {
|
||||||
@@ -134,7 +135,7 @@ while($continue) {
|
|||||||
}
|
}
|
||||||
$output = $ws->receive();
|
$output = $ws->receive();
|
||||||
|
|
||||||
client_log($mypid, "Received from websocktet: $output");
|
client_log($mypid, "Received from websocket: $output");
|
||||||
sleep(1);
|
sleep(1);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@@ -144,6 +145,7 @@ while($continue) {
|
|||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// exit child process on error
|
// exit child process on error
|
||||||
client_log($mypid, "Caught exception: ".$e->getMessage(), "error");
|
client_log($mypid, "Caught exception: ".$e->getMessage(), "error");
|
||||||
|
client_log($mypid);
|
||||||
//$log->error("Caught exception: ".$e->getMessage()."\n");
|
//$log->error("Caught exception: ".$e->getMessage()."\n");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user