luzhuqun / laravel-mqtt-publish
A simple Laravel 5 mqtt publisher
Installs: 9 641
Dependents: 0
Suggesters: 0
Security: 0
Stars: 21
Watchers: 2
Forks: 10
Open Issues: 7
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2024-11-13 20:46:55 UTC
README
Mqtt is used to publish messages from backend to andriod.
Getting start
composer require luzhuqun/laravel-mqtt-publish
How to use
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();
Learn more
A complet mqtt service incluede publisher, service and subscriber.