Mosquitto-PHP icon indicating copy to clipboard operation
Mosquitto-PHP copied to clipboard

Is php7.4.19 supported?

Open ikilobyte opened this issue 4 years ago • 0 comments

The onconnect callback did not respond, and the mqtt broker is available

php --ri mosquitto

Mosquitto support => enabled
Compiled as dynamic module
libmosquitto version => 1.5.7
Extension version => 0.4.0
php -v 

PHP 7.4.19 (cli) (built: May 12 2021 13:21:40) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
$client = new Client();
$client -> onConnect(function($code) use ($client){
    if($code === 0) {
        $mid = $client -> publish('/demo',date('Y-m-d H:i:s'),0);
    }
    $client -> loopForever();
});

$client -> onPublish(function($publishId) use ($client){
    $client -> disconnect();
});

$client -> connect('127.0.0.1');

for ($i = 0; $i < 100; $i++) {
    // Loop around to permit the library to do its work
    $client -> loop(1);
}

echo "Finished\n";

ikilobyte avatar Jun 21 '21 03:06 ikilobyte