From 3034eefb22a68ddc5805f7cae7e6dba94d802caf Mon Sep 17 00:00:00 2001 From: "altob.rd" Date: Tue, 24 Oct 2017 21:27:34 +0800 Subject: [PATCH] test --- coworker/mqtt_service.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/coworker/mqtt_service.php b/coworker/mqtt_service.php index 106fdfa..70ba545 100644 --- a/coworker/mqtt_service.php +++ b/coworker/mqtt_service.php @@ -63,8 +63,9 @@ $mqtt = new phpMQTT($mqtt_ip, $mqtt_port, uniqid()); if(!$mqtt->connect()){ die ('Could not connect mqtt'); } // 場站資料庫資訊 -$topics['#'] = array('qos'=>2, 'function'=>'procmsg'); -$mqtt->subscribe($topics, 2); +$topics['#'] = array('qos'=> 0, 'function'=>'procmsg'); +$mqtt->subscribe($topics, 0); +trigger_error("..mqtt subscribe..".print_r($topics, true)); while($mqtt->proc()){ } $mqtt->close(); @@ -80,5 +81,5 @@ function procmsg($topic, $msg) curl_setopt($ch, CURLOPT_URL, 'http://localhost/carpark.html/mqtt_service/'); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); $result = curl_exec($ch); - trigger_error( __FUNCTION__ . "..{$topic}|{$msg}..curl:{$result}.."); + trigger_error("..{$topic}|{$msg}..curl:{$result}.."); }