Blame view

README.md 1.37 KB
e0b1fe64   Peter M. Groen   Fixed script.
1
2
3
4
5
6
7
8
9
10
11
12
  MQTT-CPP
  ========
  
  Modern, asynchronous and fast C++ client for paho-mqtt ( paho-c ).
  
  **Features:**
  * Simple and clean A-synchronous API. ( Connect, publish, subscribe ).
  * Thread-safe. Use multiple topics in multiple threads..
  * Callbacks can be lambdas, class methods, bind expressions, or any [std::function]
  * Fully autonomous reconnecting
  
  # Dependencies
0bf1b2f7   Peter M. Groen   Fixed script.
13
  The only dependency is to libpaho-mqtt3a.so. Changes are there is a version for your platform ( Debian, Fedora, CentOS ).
e0b1fe64   Peter M. Groen   Fixed script.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  Just check your package manager for the correct package-name.
  
  # Tutorial
  * Clone this repository :
    ```
    git clone http://gitlab.osdev.nl/open_source/mqtt-cpp.git
    ```
   * Change to the repo and run the submodules script :
     ```
     $ cd mqtt-cpp
     $ scripts/setup_submodules -i
     ```
     This will add the cmake directory and versioning. 
   * Create a build directory and start the build.
     ```
     $ mkdir build
     $ cd build
     $ cmake ../
     $ gmake
     ```
  And you're all set. In build/bin there are two examples, test_mqtt_pu and test_mqtt_sub. Have a broker running, 
  like mosquitto or flashmq capable of accepting anonymous connections. Start the "sub" part and couple of moments
  later the "pub" part. If all went well, you should see two screens in sync running. 
0bf1b2f7   Peter M. Groen   Fixed script.
37
38
39
40
41
42
43
44
45
  
     ```
     Open terminal 1
     $ bin/test_mqtt_sub
  
     Open terminal 2
     $ bin/test_mqtt_pub
     ```
  Screen 2 is sending, Screen 1 is receiving.