ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Communication / MQTT functions
  • Overview
  • Implementation
  • How to?
  • Quality of service (QoS)
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Overview
MQTT is a "publish-subscribe" messaging protocol based on the TCP/IP protocol. From version 3.1.1, MQTT is an OASIS standard.
Two elements are found in MQTT:
  • the client, who publishes messages and who can subscribe to them.
  • the broker ("server") that receives the publications from clients, that processes them and that sends them to the clients who subscribed.
Several MQTT brokers are available (ActiveMQ, JoramMQ, OW2 JORAM, Mosquitto, RabbitMQ) as well as iOT servers compatible with MQTT (Amazon iOT, Azure iOT, etc.).
WINDEV, WEBDEV and WINDEV Mobile allow you to manage an MQTT client: you can publish and subscribe to publications.
Implementation

How to?

To implement a management of MQTT client:
  1. Define a mqttSession variable corresponding to the information required to connect to the MQTT broker.
  2. Connect to the broker (MQTTConnect).
  3. You can:
    • Publish a message (MQTTPublish). In this case, you must define:
      • the topic,
      • the quality of service (see below),
      • the message (not exceeding 256 MB),
      • whether the message must be stored (or not) on the server.
    • Subscribe to a message (MQTTSubscribe).
    • Unsubscribe (MQTTUnsubscribe, MQTTUnsubscribeAll)
  4. Disconnect (MQTTDisconnect).

Quality of service (QoS)

When publishing a message, the client defines the requested quality:
  • QoS level 0 message "At most once": The message will be delivered at most once.. The message is not stored. It is sent without guarantee of receipt. The MQTT (broker) does not inform the sender that the message was received. The message can be lost if the client is disconnected or if the server is stopped.
  • QoS level 1 message "At least once": The message will be delivered at least once.. The client will transmit the message several times if necessary until the server (broker) confirms that the message was transmitted on the network.
  • QoS level 2 message "Exactly once": The message must be saved by the sender. It will be transmitted as long as the receiver does not confirm its sending on the network. The issuer uses a sophisticated recognition with the server (broker) to avoid duplicating messages. This mode is slower but it is more secure.
Minimum version required
  • Version 22
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help