Skip to content

How to subscribe using mqtt in PHP?

//Additional callback functions required for subscribe
function subscribe() {
                       //**Store the status to a global variable - debug purposes
		$GLOBALS['statusmsg'] = $GLOBALS['statusmsg'] . "SUB-OK|";
}

function message($message) {
                       //**Store the status to a global variable  - debug purposes
		$GLOBALS['statusmsg']  = "RX-OK|";

                       //**Store the received message to a global variable
		$GLOBALS['rcv_message'] =  $message->payload;
}
See also  How to make a timer in Python?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.