ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / MQTT functions
  • Overview
  • Implementation
  • How to?
  • Quality of service (QoS)
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
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 a MQTT client: you have the ability to publish publications and to subscribe to them.
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 (<mqttSession variable>.Connect).
  3. You can:
  4. Disconnect (<mqttSession variable>.Disconnect).

Quality of service (QoS)

When publishing a message, the client defines the requested quality:
  • Message of QoS level 0 "At most once": The message will be delivered once at most. 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.
  • Message of QoS level 1 "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.
  • Message of QoS level 2 "Exactly once": The message will be necessarily saved by the issuer. It will be transmitted as long as the receiver does not confirm its sending on the network. The issuer is using a sophisticated recognition with the server (broker) to avoid duplicating messages. This mode is slower but it is more secure.
Minimum version required
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/21/2023

Send a report | Local help