Subscription part implemented and updated readme

This commit is contained in:
Salman Zafar committed 2019-06-11 19:40:29 +05:00
1 parent 6a8b433192
commit 77a8b9db13
1 file changed
+3 -3
+3 -3
View File
@@ -91,7 +91,8 @@ use Salman\Mqtt\MqttClass\Mqtt;
public function SubscribetoTopic($topic)
{
Mqtt::ConnectAndSubscribe($topic, function($topic, $msg){
$mqtt = new Mqtt();
$mqtt->ConnectAndSubscribe($topic, function($topic, $msg){
echo "Msg Received: \n";
echo "Topic: {$topic}\n\n";
echo "\t$msg\n\n";
@@ -107,8 +108,7 @@ use Mqtt;
public function SubscribetoTopic($topic)
{
$mqtt = new Mqtt();
$mqtt->ConnectAndSubscribe($topic, function($topic, $msg){
Mqtt::ConnectAndSubscribe($topic, function($topic, $msg){
echo "Msg Received: \n";
echo "Topic: {$topic}\n\n";
echo "\t$msg\n\n";