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
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Used to subscribe to a MQTT notification.
Note: This subscription can be stopped using MQTTUnsubscribe and MQTTUnsubscribeAll..
Example
gMqttSession is mqttSession
...
lbResult is boolean
lbResult = MQTTSubscribe(gMqttSession, "sensors/sensor1/temperature1", mqttQualityAtLeastOnce, ...
Proc_MQTTSubscribe)
 
// The procedure specified in MQTTSubscribe must be a project global procedure
PROCÉDURE Proc_MQTTSubscribe(pMqttSession is mqttSession, ...
Topic is string, abuffer is Buffer)
Trace("Subscription")
END
Syntax
<Result> = MQTTSubscribe(<MQTT session> , <Topic> , <Quality> , <Procedure>)
<Result>: Boolean
  • True if the subscription is implemented,
  • False otherwise.
<MQTT session>: mqttSession variable
Name of the mqttSession variable corresponding to the MQTT session to be used.
<Topic>: Character string
Topic for which the subscription is requested.
<Quality>: Integer constant
Requested quality:
mqttQualityAtLeastOnceThe 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.
mqttQualityAtMostOnceThe 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.
mqttQualityExactlyOnceThe 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 uses a sophisticated recognition with the server (broker) to avoid duplicating messages. This mode is slower but it is more secure.
<Procedure>: Name of the WLanguage procedure
Name of the WLanguage procedure ("callback") executed each time a new notification is received.
This must be a global procedure for the project: use of an internal procedure is not permitted. This procedure has the following format:
PROCEDURE <Procedure name>(<Connection> is mqttSession,
<Topic> is string, <Message> is Buffer)
where:
  • <Connection> corresponds to a mqttSession variable containing the characteristics of MQTT session.
  • <Topic> corresponds to the message topic.
  • <Message> corresponds to the message content.
Business / UI classification: Business Logic
Component: wd300com.dll
Minimum version required
  • Version 22
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/30/2024

Send a report | Local help