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 call a static method from another class in Java?

Leave a Reply

Your email address will not be published.

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