IPWorks IoT 2020 ActiveX Edition

Questions / Feedback?

Unsubscribe Method

Unsubscribes the control from the specified topic.

Syntax

mqttsncontrol.Unsubscribe TopicId, TopicIdType

Remarks

This method unsubscribes the control to the TopicId.

TopicIdType indicates the category of value specified in TopicId and may have the following values:

  • 0: Topic name - a full topic name as described in RegisterTopic to be registered by the gateway.
  • 1: Pre-defined topic id - id whose mapping to a topic name is known in advance by both the client and the gateway - no registration is necessary.
  • 2: Short topic name - has a fixed length of two bytes and is short enough that no registration is necessary. To use one, simply set the correct TopicIdType and set the TopicId to a two-character string.

Unsubscribe Examples

String fullTopicName = "full/topic/name";
mqtt1.Unsubscribe(fullTopicName, 0); // unsubscribe from topic name

mqtt1.Unsubscribe(fullTopicName+"/#", 0); // must use full topic filter if includes wildcard; can't unsubscribe from individual topics included in the filter

mqtt1.Unsubscribe("aa", 2); // unsubscribe from short topic

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks IoT 2020 ActiveX Edition - Version 20.0 [Build 8265]