added Example of publishing topic
This commit is contained in:
parent
305c0bd011
commit
28e50e2080
|
|
@ -2,7 +2,6 @@
|
|||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3ec4327d-fa62-4d8e-bb03-c6240e4c966c" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Readme.md" beforeDir="false" afterPath="$PROJECT_DIR$/Readme.md" afterDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
|
|
@ -38,8 +37,8 @@
|
|||
<entry file="file://$PROJECT_DIR$/Readme.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="364">
|
||||
<caret line="13" lean-forward="true" selection-start-line="13" selection-end-line="13" />
|
||||
<first_editor relative-caret-position="392">
|
||||
<caret line="14" column="1" lean-forward="true" selection-start-line="14" selection-start-column="1" selection-end-line="14" selection-end-column="1" />
|
||||
</first_editor>
|
||||
<second_editor />
|
||||
</state>
|
||||
|
|
@ -126,12 +125,12 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1551080016687</updated>
|
||||
<workItem from="1551080018112" duration="3663000" />
|
||||
<workItem from="1551086427460" duration="592000" />
|
||||
<workItem from="1551086427460" duration="1287000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="4255000" />
|
||||
<option name="totallyTimeSpent" value="4950000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="67" y="25" width="1853" height="1055" extended-state="6" />
|
||||
|
|
@ -204,8 +203,8 @@
|
|||
<entry file="file://$PROJECT_DIR$/Readme.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="364">
|
||||
<caret line="13" lean-forward="true" selection-start-line="13" selection-end-line="13" />
|
||||
<first_editor relative-caret-position="392">
|
||||
<caret line="14" column="1" lean-forward="true" selection-start-line="14" selection-start-column="1" selection-end-line="14" selection-end-column="1" />
|
||||
</first_editor>
|
||||
<second_editor />
|
||||
</state>
|
||||
|
|
|
|||
31
Readme.md
31
Readme.md
|
|
@ -10,4 +10,35 @@ It uses [bluerhinos/phpMQTT](https://github.com/bluerhinos/phpMQTT) as a base.
|
|||
* Certificate Protection for end to end encryption
|
||||
* Enable Debug mode to make it easier for debugging
|
||||
|
||||
## Config.php
|
||||
```
|
||||
'host' => env('mqtt_host','127.0.0.1'),
|
||||
'password' => env('mqtt_password',''),
|
||||
'username' => env('mqtt_username',''),
|
||||
'certfile' => env('mqtt_cert_file',''),
|
||||
'port' => env('mqtt_port','1883'),
|
||||
'debug' => env('mqtt_debug',false) //Optional Parameter to enable debuging set it to True
|
||||
```
|
||||
#### Publishing topic
|
||||
|
||||
```
|
||||
use Salman\Mqtt\MqttClass\Mqtt;
|
||||
|
||||
public function SendMsgViaMqtt($topic, $message)
|
||||
{
|
||||
$mqtt = new Mqtt();
|
||||
$final_topic = $serial.'/'.$topic;
|
||||
$output = $mqtt->ConnectAndSendMessage($msg,$final_topic);
|
||||
|
||||
if ($output === true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
```
|
||||
|
||||
### Tested on php 7.3 and laravel 5.7
|
||||
|
||||
# Full documentation Coming Soon
|
||||
|
|
@ -13,5 +13,5 @@ return [
|
|||
'username' => env('mqtt_username',''),
|
||||
'certfile' => env('mqtt_cert_file',''),
|
||||
'port' => env('mqtt_port','1883'),
|
||||
'debug' => env('mqtt_debug',false) //Optional Parameter to enable debuging set it to True
|
||||
'debug' => env('mqtt_debug',false) //Optional Parameter to enable debugging set it to True
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue