PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
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
Used to subscribe to a MQTT notification.
Note: This subscription can be stopped by MQTTUnsubscribe and MQTTUnsubscribeAll.
Example
lbResult is boolean
lbResult = MQTTSubscribe(gMqttSession, "sensors/sensor1/temperature1", mqttQualityAtLeastOnce, ...
Proc_MQTTSubscribe)

INTERNAL PROCEDURE 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 mqttSession variable corresponding to the MQTT session to use.
<Topic>: Character string (with quotes)
Topic for which the subscription is requested.
<Quality>: Integer constant
Requested quality:
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 is using a sophisticated recognition with the server (broker) to avoid duplicating messages. This mode is slower but it is more secure.
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.
<Procedure>: Character string (with or without quotes)
Procedure called for each notification Name of WLanguage procedure ("callback") run for each new notification. This procedure has the following format:
PROCEDURE <ProcedureName>(<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.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230com.dll
Minimum required version
  • Version 22
This page is also available for…
Comments
Click [Add] to post a comment