PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Properties specific to the description of mqttSession variables
  • Authentication mode
  • Functions that handle the mqttSession variables
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
mqttSession (Type of variable)
In french: mqttSession
The mqttSession type is used to define the parameters for connecting to the MQTT broker. These connection parameters can be defined and modified by several WLanguage properties.
Remark: See Declaring a variable for more details on the declaration of this type of variable and the use of WLanguage properties.
Versions 24 and later
Android This type of variable is now available for Android applications.
New in version 24
Android This type of variable is now available for Android applications.
Android This type of variable is now available for Android applications.
Example
// Declare the MQTT connection
gMqttSession is mqttSession
 
// Retrieve the data typed in the connection window
gMqttSession.Address = SAI_Address_Broker
gMqttSession.Port = SAI_Port
gMqttSession.Option = INT_SSL
gMqttSession.TimeoutConnection = SAI_Timeout_Connection
gMqttSession.User = SAI_Login
gMqttSession.UserPassword = SAI_PSW
gMqttSession.PrivateKey = SAI_Private_Key
gMqttSession.PrivatePassword = SAI_PSW_Private_Key
gMqttSession.IDClient = SAI_IDClient
gMqttSession.SessionVid = INT_Session_Virgin
IF MQTTConnect(gMqttSession) THEN
Message("Connection OK")
ELSE
Error("Connection problem. '" + ErrorInfo() + "')")
END
Remarks

Properties specific to the description of mqttSession variables

The following properties can be used to handle a MQTT session:
Property nameType usedEffect
AddressCharacter stringAddress of MQTT server (also called "MQTT broker"). This address can be given in the following format:
  • IP address in XXX.XXX.XXX.XXX format (125.5.110.100 for example).
  • IP address containing the server name (MQTTServer for example). This syntax is recommended.
PrivateKeyCharacter string or Certificate variableName of the variable of type Certificate or path of the pem key file (to realize an Connection by private key).
If this property is specified, an authentication by key is performed: only the properties .User, .PrivateKey and .PrivateKeyPassword are taken into account..
IDClientCharacter stringClient identifier. This property must not be left empty.
PrivateKeyPasswordCharacter stringPassword of key file (for a connection by private key). The Property .CléPrivée corresponds to the private key to use.
UserPasswordCharacter stringUser's password used for password authentication (the Property User corresponds to the user's name).
OptionInteger constantConnection options. This property can correspond to the optionSSL constant for an SSL connection.
PortIntegerPort of MQTT server. This port correspondsn to 1883 by default (or 8883 for an SSL connection).
CleanSessionBoolean
  • True to clean the generic global parameters on the server,
  • False otherwise.
ConnectionTimeoutInteger ou DurationConnection timeout in seconds. This property can correspond to:
  • an integer corresponding to the number of seconds,
  • a Duration variable,
  • Versions 23 and later
    direct indication of Duration (e.g. 10 s).
    New in version 23
    direct indication of Duration (e.g. 10 s).
    direct indication of Duration (e.g. 10 s).
UserCharacter stringUser name.

Authentication mode

The authentication by key has priority over the authentication by password.
The authentication by key is attempted if:
  • the server supports this authentication mode.
  • the Property PrivateKey is filled in..
The authentication by password is attempted if:
  • the server supports this authentication mode.
  • the Property UserPassword is filled in..

Functions that handle the mqttSession variables

The following functions are used to handle the mqttSession variables:
Versions 22 and later
MQTTConnect
New in version 22
MQTTConnect
MQTTConnect
Used to connect to a MQTT server (also called "Broker").
Versions 22 and later
MQTTDisconnect
New in version 22
MQTTDisconnect
MQTTDisconnect
Allows you to disconnect from a MQTT server (also called "Broker").
Versions 22 and later
MQTTPublish
New in version 22
MQTTPublish
MQTTPublish
Publishes a message on the MQTT broker.
Versions 22 and later
MQTTSubscribe
New in version 22
MQTTSubscribe
MQTTSubscribe
Used to subscribe to a MQTT notification.
Versions 22 and later
MQTTUnsubscribe
New in version 22
MQTTUnsubscribe
MQTTUnsubscribe
Used to unsubscribe from a MQTT notification.
Versions 22 and later
MQTTUnsubscribeAll
New in version 22
MQTTUnsubscribeAll
MQTTUnsubscribeAll
Allows you to unsubscribe from all the existing subscriptions.
See also
Minimum version required
  • Version 22
This page is also available for…
Comments
Click [Add] to post a comment