Skip to content

dreamz-group/libmqtthelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libmqtthelper

This library is used to simplefy implementation of mqtt clients in C and C++ services.

#include "mqtthelper.h"

int hello_cb(void *notused, const char *topic, void *msg, int msg_len, void *user_data)
{
  return 0;
}

int main(int argc, char* argv[])
{
    int ret = 0;

    // Init the Mosquitto
    mqtt_helper_init();
    // Subscribe to topic
    ret = mqtt_helper_add("hello/world",      &hello_cb,       NULL, NULL);
    
    mqtt_helper_connection_monitor();
    
    // Send a message.
    const char* payload = "Let's make this greate";
    mqtt_helper_publish("hello/strange", payload, strlen(payload));
    
    while( true ) {
      // Do stuff.
    }
    mqtt_helper_cleanup();
    return 0;   
}

About

Simplify mqtt implementation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published