项目作者: luzhuqun

项目描述 :
A laravel mqtt publisher
高级语言: PHP
项目地址: git://github.com/luzhuqun/laravel-mqtt-publish.git
创建时间: 2016-12-15T00:41:02Z
项目社区:https://github.com/luzhuqun/laravel-mqtt-publish

开源协议:

下载


Laravel Mqtt Publisher

Mqtt is used to publish messages from backend to andriod.

Getting start

composer require luzhuqun/laravel-mqtt-publish

How to use

  1. use Lzq\Mqtt\SamMessage;
  2. use Lzq\Mqtt\SamConnection;
  3. $conn = new SAMConnection();//create a new connection object
  4. $conn->connect('mqtt', array('SAM_HOST' => '192.168.10.147', 'SAM_PORT' => '1883'));//start initialise the connection
  5. $msgCpu = new SAMMessage('hehe');//create a new MQTT message with the output of the shell command as the body
  6. $conn->send('topic://'.'tokudu/ab7867d9fd60db65', $msgCpu);//send the message on the topic cpu
  7. $conn->disconnect();

Learn more

A complet mqtt service incluede publisher, service and subscriber.

service

mosquitto

subscriber

AndroidPushNotificationsDemo