private void InvokeHandlersForIncomingPublish(PublishPacket message) { var handler = client.MessageReceivedHandler; if (handler != null) { handler.OnMesage(message.ToMessage()); } }
private Task ProcessReceivedPublishPacketAsync(PublishPacket publishPacket) { OnMessageReceived(_options.ClientId, publishPacket.ToMessage()); switch (publishPacket.Qos) { case MqttQos.AtMostOnce: return(Task.CompletedTask); case MqttQos.AtLeastOnce: return(SendAsync(new PubAckPacket(publishPacket.PacketId))); case MqttQos.ExactlyOnce: return(SendAsync(new PubRecPacket(publishPacket.PacketId))); default: throw new MqttException("Received a not supported QoS level."); } }