Skip to content

cfullelove/php-mqtt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-mqtt

Install

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/cfullelove/php-mqtt"
        }
    ],
	"require": {
        "cfullelove/php-mqtt": "dev-master"
	}
}

Example

require( __DIR__ . "/vendor/autoload.php" );

$loop = \React\EventLoop\Factory::create();

$client = new MQTT\Client("localhost", 1883, "client-id", $loop);

$client->on( "connect", function() use ($client, $tty ) {
	$client->subscribe( [ "#" => [ 'qos' => 0 ] ] );
});

$client->on( 'message', function( $topic, $message) {
	printf( "%s : %s" . PHP_EOL, $topic, $message );
});

$client->connect();

$loop->run();

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages