阿里云物联网 .NET Core 客户端 | CZGL.AliIoTClient:8 委托事件
CZGL.AliIoTClient 里设置了 7 个委托事件,在程序的不不同生命周期触发。

1)7个委托事件
/// <summary>/// 服务器属性设置/// </summary>public PublishPropertyEventHandler PubPropertyEventHandler;/// <summary>/// 服务调用/// </summary>public PublishServiceEventHandler PubServiceEventHandler;/// <summary>/// 收到其它Topic时触发/// </summary>public PublishCommonEventHandler PubCommonEventHandler;/// <summary>/// 当 QOS=1或2时,收到订阅触发/// </summary>public uPLibrary.Networking.M2Mqtt.MqttClient.MqttMsgPublishedEventHandler PubedEventHandler;/// <summary>/// 向服务器发布 Topic 时/// </summary>public uPLibrary.Networking.M2Mqtt.MqttClient.MqttMsgSubscribedEventHandler SubedEventHandler;/// <summary>/// 向服务器发布 Topic 失败时/// </summary>public uPLibrary.Networking.M2Mqtt.MqttClient.MqttMsgUnsubscribedEventHandler UnSubedEventHandler;/// <summary>/// 断开连接时/// </summary>public uPLibrary.Networking.M2Mqtt.MqttClient.ConnectionClosedEventHandler ConnectionClosedEventHandler;
使用方法
public static void TestEvent(object sender, MqttMsgPublishEventArgs e){{// handle message receivedstring topic = e.Topic;string message = Encoding.ASCII.GetString(e.Message);Console.WriteLine("- - - - - - - - - - ");Console.WriteLine("get topic message,Date: " DateTime.Now.ToLongTimeString());Console.WriteLine("topic: " topic);Console.WriteLine("get messgae :" message);}
client.PubPropertyEventHandler = TestEvent;
这里是旧版本的文档,可以参考一下。
https://www.cnblogs.com/whuanle/p/10786991.html
-
07.24
吉星派对阿兰娜玩法攻略
-
07.24
iPhone17Pro系列有啥颜色
-
07.24
奥特曼超时空英雄战斗技巧有哪些
-
07.24
魔域中何为东方美
-
07.24
原神月之三角色卡池如何选择
-
07.24
我的冬季汽车官网地址在哪
-
-
下载
- |
-
-
下载
- 《行尸走肉第一章》免安装中文汉化硬盘版下载
- 单机|436 MB
- 一款以动作冒险为主题的游戏
-
-
下载
- 《街头霸王X铁拳》免安装中文汉化硬盘版下载
- 单机|111MB
- 一款非常好玩的格斗游戏
-
-
下载
- |
-
-
下载
- 《暗黑破坏神3》免安装繁体中文正式版下载
- 单机|7630 MB
- 一款以角色扮演为主题的游戏
-
-
下载
- 《马克思佩恩3》免安装硬盘版下载
- 单机|27033 MB
- 一款以第三人称射击为主题的游戏