walkor / mqtt

Asynchronous MQTT client for PHP based on workerman.
207 stars 46 forks source link

How to publish message with out the loop? #6

Open badmansan opened 5 years ago

badmansan commented 5 years ago

Hello! I am using bunny to work with RabbitMQ, the code is:

$client = (new Bunny\Client())->connect()->channel();
// ...
$channel->run(function(Message $message, Channel $channel, Client $client) {
    // --> here i need to send a message to MQTT broker;
}, 'hello', '', FALSE, TRUE);

It is infinite loop, so i need to send message and return to loop, is it possible?