PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Implementation
  • How to proceed?
  • Quality of service (QoS)
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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, ...).
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 proceed?

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:
  • 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 required version
  • Version 22
This page is also available for…
Comments
Click [Add] to post a comment