public Task EnqueueApplicationMessageAsync(MqttApplicationMessage applicationMessage) { if (applicationMessage == null) { throw new ArgumentNullException(nameof(applicationMessage)); } var publishPacketFactory = new MqttPublishPacketFactory(); _session.EnqueuePacket(new MqttPacketBusItem(publishPacketFactory.Create(applicationMessage))); return(PlatformAbstractionLayer.CompletedTask); }
public Task DeliverApplicationMessageAsync(MqttApplicationMessage applicationMessage) { if (applicationMessage == null) { throw new ArgumentNullException(nameof(applicationMessage)); } var publishPacketFactory = new MqttPublishPacketFactory(); var packetBusItem = new MqttPacketBusItem(publishPacketFactory.Create(applicationMessage)); _session.EnqueuePacket(packetBusItem); return(packetBusItem.WaitForDeliveryAsync()); }