-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MQTT服务器是否可以主动向客户端发送消息 #6
Comments
看IMqttHandler的定义,其中的Publish就是用下向下发布消息。 ` /// /// public interface IMqttHandler { /// /// 消息 /// MqttMessage? Process(MqttMessage message);
} |
感谢作者的指点,但是我还是没有解决,我不知道如何获取到MqttHandler的实例服务,我用下面的方法写的会出现 public void PublishMessage(string topic,string message) |
以下代码,来自商用版FIoT平台。 using System.Text.RegularExpressions; namespace IoTServer.Services; /// public class MqttController : MqttHandler { #region 属性 private readonly MyDeviceService _deviceService; private readonly ThingService _thingService; private readonly MqttService _mqttService; private readonly QueueService _queue; private CancellationTokenSource _source; #endregion
} |
上面的案例是在实现MqttHandler接口的情况下去做方式数据,我希望做到的在业务中去使用PublishAsync方法去主动发送数据而不是在连接或断开事件后被动触发 我想实现的是一个线程,定时发布一条数据数据 |
MQTT服务器是否可以主动向客户端发送消息,如果可以该如何做
The text was updated successfully, but these errors were encountered: