Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is php7.4.19 supported? #122

Open
ikilobyte opened this issue Jun 21, 2021 · 0 comments
Open

Is php7.4.19 supported? #122

ikilobyte opened this issue Jun 21, 2021 · 0 comments

Comments

@ikilobyte
Copy link

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";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant