AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Comunicación / Funciones MQTTT
  • Properties specific to mqttSession variables
  • Authentication mode
  • Functions that use mqttSession variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Otros
Procedimientos almacenados
mqttSession (Variable type)
 
The mqttSession type is used to define the parameters for connecting to the MQTT broker. These connection parameters can be defined and changed by several WLanguage properties.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Ejemplo
// Déclaration de la connexion MQTT
gMqttSession is mqttSession

// Récupère les données saisies dans la fenêtre de connexion
gMqttSession.Address = SAI_Adresse_Broker
gMqttSession.Port = SAI_Port
gMqttSession.Option = INT_SSL
gMqttSession.ConnectionTimeout = SAI_Timeout_Connexion
gMqttSession.User = SAI_Login
gMqttSession.UserPassword = SAI_PSW
gMqttSession.PrivateKey = SAI_Clé_Privée
gMqttSession.PrivateKeyPassword = SAI_PSW_Clé_Privée
gMqttSession.ClientID = SAI_IDClient
gMqttSession.CleanSession = INT_Session_Vierge
IF MQTTConnect(gMqttSession) THEN
Message("Connexion OK")
ELSE
Error("Problème de connexion. '" + ErrorInfo() + "')")
END
Observaciones

Properties specific to 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.
CleanSessionBoolean
  • True to clean the generic global parameters on the server,
  • False otherwise.
ClientIDCharacter stringClient identifier. This property must not be left empty.
ConnectionTimeoutInteger or DurationConnection timeout in seconds. This property can correspond to:
  • an integer corresponding to the number of seconds,
  • a Duration variable,
  • the duration in a readable format (e.g., 10 s).
Novedad versión 2024
IgnoreError
Integer constantSpecifies the ignored errors. Corresponds to a constant or to a combination of constants:
  • mqttIgnoreExpiredCertificate: The certificate date is ignored.
  • mqttIgnoreInvalidCertificate: The certificate is ignored.
  • mqttIgnoreInvalidCertificateName: The site name specified in the certificate is ignored.
  • mqttIgnoreRevocation: The certificate revocation is ignored.
OptionInteger constantConnection options. This property can correspond to the optionSSL constant for an SSL connection.
PortentierPort of MQTT server. This port correspondsn to 1883 by default (or 8883 for an SSL connection).
PrivateKeyCharacter string or Certificate variableName of the Certificate variable or path of the pem file (to make a private key connection).
If this property is specified, an authentication by key is performed: only the User, PrivateKey and PrivateKeyPassword properties are taken into account.
PrivateKeyPasswordCharacter stringPassword of key file (for a connection by private key). The PrivateKey property corresponds to the private key to be used.
UserCharacter stringUser name.
UserPasswordCharacter stringUser's password used in password authentication (the User property is the user's name).

Authentication mode

The authentication by key has priority over the authentication by password.
Key authentication is used if:
  • the server supports this authentication mode.
  • the PrivateKey property is specified.
Password authentication is used if:
  • the server supports this authentication mode.
  • the UserPassword is specified.

Functions that use mqttSession variables

The following functions are used to handle mqttSession variables:
MQTTConnectSe utiliza para conectarse a un servidor MQTT (también llamado "Broker").
MQTTDesconectarLe permite desconectarse de un servidor MQTT (también llamado "Broker").
MQTTPublicarPublica un mensaje en el broker MQTT.
MQTTTSubscribeSe utiliza para suscribirse a un MQTT Notification.
MQTTUnsubscribeSe utiliza para cancelar la suscripción de un MQTT Notification.
MQTTUnsubscribeAllLe permite darse de baja de todas las suscripciones existentes.
Ver también
Versión mínima requerida
  • Versión 22
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/02/2024

Señalar un error o enviar una sugerencia | Ayuda local