MqttClientUnSubscribeMessage 方法 (String) |
取消订阅指定的主题信息,取消之后,就不再接收当前主题的数据,除非服务器强制推送
Unsubscribe from the specified topic information. After cancellation, the data of the current topic will no longer be received unless the server forces push
命名空间:
HslCommunication.MQTT
程序集:
HslCommunication (在 HslCommunication.dll 中) 版本:12.1.2.0 (12.1.2.0)
语法 public OperateResult UnSubscribeMessage(
string topic
)
Public Function UnSubscribeMessage (
topic As String
) As OperateResult
public:
OperateResult^ UnSubscribeMessage(
String^ topic
)
member UnSubscribeMessage :
topic : string -> OperateResult
参数
- topic
- 类型:SystemString
主题信息
返回值
类型:
OperateResult取消订阅结果
示例
参照
MqttClient 的示例说明。
MqttClient mqttClient = new MqttClient( new MqttConnectionOptions( )
{
ClientId = "ABC",
IpAddress = "127.0.0.1",
} );
HslCommunication.OperateResult sub = mqttClient.UnSubscribeMessage( "A" );
if (sub.IsSuccess)
{
}
else
{
}
参见