Coder Social home page Coder Social logo

paho.mqtt.c-1's Introduction

Eclipse Paho MQTT C client

This repository contains the source code for the Eclipse Paho MQTT C client library.

This code builds libraries which enable applications to connect to an MQTT broker to publish messages, and to subscribe to topics and receive published messages.

Both synchronous and asynchronous modes of operation are supported.

Build requirements / compilation

The build process requires GNU Make and gcc, and also requires OpenSSL libraries and includes to be available. There are make rules for a number of Linux "flavors" including ARM and s390, OS X, AIX and Solaris.

The documentation requires doxygen and optionally graphviz.

Before compiling, set some environment variables (or pass these values to the make command directly) in order to configure library locations and other options.

Specify the location of OpenSSL using SSL_DIR

e.g. using homebrew on OS X:

export SSL_DIR=/usr/local/Cellar/openssl/1.0.1e

Specify where the source files are in relation to where the make command is being executed.

export MQTTCLIENT_DIR=../src

To build the samples, enable the option (BUILD_SAMPLES), and specify the location of the code:

export BUILD_SAMPLES=YES
export SAMPLES_DIR=../src/samples

One more useful environment variable is TARGET_PLATFORM. This provides for cross-compilation. Currently the only recognised value is "Arm" - for instance to cross-compile a Linux ARM version of the libraries:

export TARGET_PLATFORM=Arm

Libraries

The Paho C client comprises four shared libraries:

  • libmqttv3a.so - asynchronous
  • libmqttv3as.so - asynchronous with SSL
  • libmqttv3c.so - "classic" / synchronous
  • libmqttv3cs.so - "classic" / synchronous with SSL

Usage and API

Detailed API documentation is available by building the Doxygen docs in the doc directory. A snapshot is also available online.

Samples are available in the Doxygen docs and also in src/samples for reference.

Note that using the C headers from a C++ program requires the following declaration as part of the C++ code:

    extern "C" {
    #include "MQTTClient.h"
    #include "MQTTClientPersistence.h"
    }

Runtime tracing

A number of environment variables control runtime tracing of the C library.

Tracing is switched on using MQTT_C_CLIENT_TRACE (a value of ON traces to stdout, any other value should specify a file to trace to).

The verbosity of the output is controlled using the MQTT_C_CLIENT_TRACE_LEVEL environment variable - valid values are ERROR, PROTOCOL, MINIMUM, MEDIUM and MAXIMUM (from least to most verbose).

The variable MQTT_C_CLIENT_TRACE_MAX_LINES limits the number of lines of trace that are output.

export MQTT_C_CLIENT_TRACE=ON
export MQTT_C_CLIENT_TRACE_LEVEL=PROTOCOL

Reporting bugs

Please report bugs under the "MQTT-C" Component in Eclipse Bugzilla for the Paho Technology project.

More information

Discussion of the Paho clients takes place on the Eclipse paho-dev mailing list.

General questions about the MQTT protocol are discussed in the MQTT Google Group.

There is much more information available via the MQTT community site.

paho.mqtt.c-1's People

Contributors

andypiper avatar ralight avatar jpwsutton avatar icraggs avatar rpoisel avatar zaporozhets avatar

Watchers

James Cloos avatar Stef Boerrigter avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.