mqttUnsubscribe (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

3.12 / 1.00.00


This function will remove a subscription from a MQTT server.

 

 

Input:

handle : INT

The handle to the MQTT connection.

 

topic : STRING

The topic of the subscription.

 

 

Returns: INT

0

- Subscription is removed.

1

- Invalid handle.

2

- Not connected to the MQTT server.

3

- Invalid parameter.

 

Declaration:

FUNCTION mqttUnsubscribe : INT;
VAR_INPUT
  handle : INT;
  topic : STRING;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
VAR
  mqtt : INT;
  rc   : INT;
END_VAR;
 
PROGRAM example;
BEGIN
  ...
  rc := mqttUnsubscribe(handle := mqtt, topic := "RTCU/+/temperature");
  DebugFmt(message := "Unsubscribed= \1", v1 := rc);
  ...
END;
END_PROGRAM;