All Projects → emqx → Qmqtt

emqx / Qmqtt

Licence: other
MQTT Client for Qt

Projects that are alternatives of or similar to Qmqtt

Hivemq Mqtt Client
HiveMQ MQTT Client is an MQTT 5.0 and MQTT 3.1.1 compatible and feature-rich high-performance Java client library with different API flavours and backpressure support
Stars: ✭ 402 (-1.71%)
Mutual labels:  mqtt, mqtt-client
ESPecial
ESP32 automation with web interface and telegram bot
Stars: ✭ 77 (-81.17%)
Mutual labels:  mqtt, mqtt-client
wyzesense2mqtt
Configurable WyzeSense to MQTT Gateway intended for use with Home Assistant or other platforms that use MQTT discovery mechanisms.
Stars: ✭ 55 (-86.55%)
Mutual labels:  mqtt, mqtt-client
mqtt-datasource
MQTT Datasource for Grafana allows streaming data from any MQTT broker running either locally or remotely.
Stars: ✭ 99 (-75.79%)
Mutual labels:  mqtt, mqtt-client
Mqtt Panel
A web interface for MQTT
Stars: ✭ 315 (-22.98%)
Mutual labels:  mqtt, mqtt-client
zmosq
MQTT/Mosquitto / ZeroMQ proxy
Stars: ✭ 22 (-94.62%)
Mutual labels:  mqtt, mqtt-client
WeConnect-mqtt
MQTT Client that publishes data from Volkswagen WeConnect
Stars: ✭ 14 (-96.58%)
Mutual labels:  mqtt, mqtt-client
Android Mqtt Service
A simple MQTT Service that will keep running for the duration of your Android application using the Paho Java MQTT Client.
Stars: ✭ 238 (-41.81%)
Mutual labels:  mqtt, mqtt-client
Kmansonoff
Firmware for ESP8266 based itead Sonoff switches for use with HomeAssistant / mqtt
Stars: ✭ 282 (-31.05%)
Mutual labels:  mqtt, mqtt-client
node-deepstackai-trigger
Detects motion using Deepstack AI and calls registered triggers based on trigger rules.
Stars: ✭ 154 (-62.35%)
Mutual labels:  mqtt, mqtt-client
CODESYS-MQTT
MQTT client library for CODESYS, supporting all QoS
Stars: ✭ 63 (-84.6%)
Mutual labels:  mqtt, mqtt-client
Tdm
GUI application to discover and monitor devices flashed with https://github.com/arendst/Sonoff-Tasmota
Stars: ✭ 385 (-5.87%)
Mutual labels:  mqtt, mqtt-client
mqttools
MQTT version 5.0 client and broker using asyncio
Stars: ✭ 44 (-89.24%)
Mutual labels:  mqtt, mqtt-client
mqtt-mock
mqtt压测工具。支持subscribe、publish压测方式,支持模拟客户端连接数。
Stars: ✭ 78 (-80.93%)
Mutual labels:  mqtt, mqtt-client
Emqtt
Erlang MQTT v5.0 Client
Stars: ✭ 253 (-38.14%)
Mutual labels:  mqtt, mqtt-client
ArduinoMqtt
MQTT client for Arduino
Stars: ✭ 58 (-85.82%)
Mutual labels:  mqtt, mqtt-client
Mqttclient
A high-performance, high-stability, cross-platform MQTT client, developed based on the socket API, can be used on embedded devices (FreeRTOS / LiteOS / RT-Thread / TencentOS tiny), Linux, Windows, Mac, with a very concise The API interface realizes the quality of service of QOS2 with very few resources, and seamlessly connects the mbedtls encryption library.
Stars: ✭ 234 (-42.79%)
Mutual labels:  mqtt, mqtt-client
Iot Harbor
reactor3实现的mqtt库
Stars: ✭ 234 (-42.79%)
Mutual labels:  mqtt, mqtt-client
asyncio-mqtt
Idomatic asyncio wrapper around paho-mqtt
Stars: ✭ 137 (-66.5%)
Mutual labels:  mqtt, mqtt-client
Wolfmqtt
wolfMQTT is a small, fast, portable MQTT client implementation, including support for TLS 1.3.
Stars: ✭ 316 (-22.74%)
Mutual labels:  mqtt, mqtt-client

QMQTT

mqtt client for Qt

Please compile the library with Qt >= 5.3 version. On Windows you need to specify CONFIG += NO_UNIT_TESTS, since gtest is not supported.

SSL is enabled by default, if the version of OpenSSL < 1.0.2, SSL may not be supported.

Disable the SSL in CMakeLists.txt (cmake):

option( ${PROJECT_NAME}_SSL "Enable SSL support for MQTT" OFF )

Disable the SSL with src/mqtt/qmqtt.pro (qmake):

CONFIG+=QMQTT_NO_SSL

To add websocket support, compile the library with Qt >= 5.7, and specify 'CONFIG += QMQTT_WEBSOCKETS'. This also works when compiling qmqtt for WebAssembly.

Usage

In your QMake project, add:

QT += qmqtt

Connect using TCP:

#include "qmqtt.h"

QMQTT::Client *client = new QMQTT::Client(QHostAddress::LocalHost, 1883);
client->setClientId("clientId");
client->setUsername("user");
client->setPassword("password");
client->connectToHost();

Connect using SSL:

QSslConfiguration sslConfig = QSslConfiguration::defaultConfiguration();
// Add custom SSL options here (for example extra certificates)
QMQTT::Client *client = new QMQTT::Client("example.com", 8883, sslConfig);
client->setClientId("clientId");
client->setUsername("user");
client->setPassword("password");
// Optionally, set ssl errors you want to ignore. Be careful, because this may weaken security.
// See QSslSocket::ignoreSslErrors(const QList<QSslError> &) for more information.
client->ignoreSslErrors(<list of expected ssl errors>)
client->connectToHost();
// Here's another option to suppress SSL errors (again, be careful)
QObject::connect(client, &QMQTT::Client::sslErrors, [&](const QList<QSslError> &errors) {
    // Investigate the errors here, if you find no serious problems, call ignoreSslErrors()
    // to continue connecting.
    client->ignoreSslErrors();
});

Connect using WebSockets:

QMQTT::Client *client = new QMQTT::Client("ws://www.example.com/mqtt", "<origin>", QWebSocketProtocol::VersionLatest);
client->setClientId("clientId");
client->setUsername("user");
client->setPassword("password");
client->connectToHost();

Slots

void setHost(const QHostAddress& host);
void setPort(const quint16 port);
void setClientId(const QString& clientId);
void setUsername(const QString& username);
void setPassword(const QString& password);
void setKeepAlive(const int keepAlive);
void setCleanSession(const bool cleansess);
void setAutoReconnect(const bool value);
void setAutoReconnectInterval(const int autoReconnectInterval);
void setWillTopic(const QString& willTopic);
void setWillQos(const quint8 willQos);
void setWillRetain(const bool willRetain);
void setWillMessage(const QString& willMessage);

void connectToHost();
void disconnectFromHost();

quint16 subscribe(const QString& topic, const quint8 qos);
void unsubscribe(const QString& topic);

quint16 publish(const Message& message);

Signals

void connected();
void disconnected();
void error(const QMQTT::ClientError error);

void subscribed(const QString& topic, const quint8 qos);
void unsubscribed(const QString& topic);
void published(const quint16 msgid, const quint8 qos);
void pingresp();
void received(const QMQTT::Message& message);

License

New BSD License

Contributors

@Kampfgnom

@rafaeldelucena

@Vortex375

@mwallnoefer

@KonstantinRitt

@cncap

@Psy-Kai

@ejvr

@keytee

Authors

@emqplus Feng Lee [email protected]

@wguynes William Guynes [email protected]

@wuming123057 Xuan [email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].