|
@@ -94,16 +94,16 @@ function lampMqttCmd($sendTopic,$backTopic,$sendData,$timeout = 5,$seq = ''){
|
|
|
$mqtt = new Mqtt($server, $port, $client_id);
|
|
|
|
|
|
if($mqtt->connect(true, NULL, $username, $password)) { //链接不成功再重复执行监听连接
|
|
|
- $mqtt->publish($sendTopic, $sendData, 0);
|
|
|
+ $mqtt->publish($sendTopic, $sendData, 2);
|
|
|
// $mqtt->publish('/WEGW/ReadIn/865860046894466', pack('H*','010AA00B'), 2);
|
|
|
}else{
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
- $topics[$backTopic] = array("qos" => 0,"function" => "procmsg");
|
|
|
+ $topics[$backTopic] = array("qos" => 2,"function" => "procmsg");
|
|
|
// $topics['/WEGW/ReadOut/865860046894466'] = array("qos" => 2, "function" => "procmsg");
|
|
|
// 订阅主题
|
|
|
- $mqtt->subscribe($topics, 0);
|
|
|
+ $mqtt->subscribe($topics, 2);
|
|
|
$true = 1;
|
|
|
$t = time();
|
|
|
while($true == 1){
|
|
@@ -117,6 +117,7 @@ function lampMqttCmd($sendTopic,$backTopic,$sendData,$timeout = 5,$seq = ''){
|
|
|
}
|
|
|
}
|
|
|
$mqtt->close();
|
|
|
+ $true['msg'] = substr($true['msg'], 2);
|
|
|
return $true;
|
|
|
}
|
|
|
|
|
@@ -647,7 +648,7 @@ function send_websocket($clientid,$data = array(),$resType='cmd')
|
|
|
{
|
|
|
if (!empty($clientid)) {
|
|
|
$CI =& get_instance();
|
|
|
- if (isset($data['data'])) $data['data']['status'] = 2;
|
|
|
+ // if (isset($data['data'])) $data['data']['status'] = 2;
|
|
|
$CI->db->insert('message',['client'=>$clientid,'msg'=>json_encode($data)]);
|
|
|
}
|
|
|
|