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  Python code snippet - google colab How to upload a folder?

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.