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