Subscription part implemented and updated readme
This commit is contained in:
parent
6a8b433192
commit
77a8b9db13
|
|
@ -91,7 +91,8 @@ use Salman\Mqtt\MqttClass\Mqtt;
|
||||||
|
|
||||||
public function SubscribetoTopic($topic)
|
public function SubscribetoTopic($topic)
|
||||||
{
|
{
|
||||||
Mqtt::ConnectAndSubscribe($topic, function($topic, $msg){
|
$mqtt = new Mqtt();
|
||||||
|
$mqtt->ConnectAndSubscribe($topic, function($topic, $msg){
|
||||||
echo "Msg Received: \n";
|
echo "Msg Received: \n";
|
||||||
echo "Topic: {$topic}\n\n";
|
echo "Topic: {$topic}\n\n";
|
||||||
echo "\t$msg\n\n";
|
echo "\t$msg\n\n";
|
||||||
|
|
@ -107,8 +108,7 @@ use Mqtt;
|
||||||
|
|
||||||
public function SubscribetoTopic($topic)
|
public function SubscribetoTopic($topic)
|
||||||
{
|
{
|
||||||
$mqtt = new Mqtt();
|
Mqtt::ConnectAndSubscribe($topic, function($topic, $msg){
|
||||||
$mqtt->ConnectAndSubscribe($topic, function($topic, $msg){
|
|
||||||
echo "Msg Received: \n";
|
echo "Msg Received: \n";
|
||||||
echo "Topic: {$topic}\n\n";
|
echo "Topic: {$topic}\n\n";
|
||||||
echo "\t$msg\n\n";
|
echo "\t$msg\n\n";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue