Package Data | |
---|---|
Maintainer Username: | luzhuqun |
Maintainer Contact: | 595500783@qq.com (luzhuqun) |
Package Create Date: | 2016-12-15 |
Package Last Update: | 2018-10-14 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-22 03:08:24 |
Package Statistics | |
---|---|
Total Downloads: | 9,667 |
Monthly Downloads: | 25 |
Daily Downloads: | 0 |
Total Stars: | 21 |
Total Watchers: | 2 |
Total Forks: | 10 |
Total Open Issues: | 7 |
Mqtt is used to publish messages from backend to andriod.
composer require luzhuqun/laravel-mqtt-publish
use Lzq\Mqtt\SamMessage;
use Lzq\Mqtt\SamConnection;
$conn = new SAMConnection();//create a new connection object
$conn->connect('mqtt', array('SAM_HOST' => '192.168.10.147', 'SAM_PORT' => '1883'));//start initialise the connection
$msgCpu = new SAMMessage('hehe');//create a new MQTT message with the output of the shell command as the body
$conn->send('topic://'.'tokudu/ab7867d9fd60db65', $msgCpu);//send the message on the topic cpu
$conn->disconnect();
A complet mqtt service incluede publisher, service and subscriber.