Skip to content

Commit

Permalink
added a useful readme
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverlorenz committed May 6, 2015
1 parent 9b4cd70 commit ca12d74
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# reactMqtt
# ReactPHP MQTT

reactMqtt is a mqtt client library PHP. Its based on the reactPHP socket-client and added the mqtt protocol specific functions
reactMqtt is a mqtt client library PHP. Its based on the reactPHP socket-client and added the mqtt protocol specific functions. I hope its a better starting point that the existing php mqtt libraries.

### Notice - (May 6th, 2015)
This is the first initial commit. Only some things work already:
* Connect
* Connection Ack
* publish

I will add more features if I need them. If you need features: please give feedback or contribute to get this library running.

## Goal

Goal of this project is easy to use mqtt client for PHP in a modern architecture. Currently, only protocol version 4 (mqtt 3.1.1) is implemented.
* Protocol specifications: http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/csprd02/mqtt-v3.1.1-csprd02.html

## Example publish
```php
<?php

require __DIR__ . '/../vendor/autoload.php';

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

$dnsResolverFactory = new React\Dns\Resolver\Factory();
$resolver = $dnsResolverFactory->createCached('8.8.8.8', $loop);

$version = new oliverlorenz\reactphpmqtt\protocol\Version4();
$connector = new oliverlorenz\reactphpmqtt\Connector($loop, $resolver, $version);

$connector->create('yourmqttserver.tdl', 1883);
$connector->onConnected(function() use ($connector) {
$connector->publish('a/b', 'example message');
});
$loop->run();


```

0 comments on commit ca12d74

Please sign in to comment.