public ushort Publish( MqttConnection connection, string topic, byte[] message, byte qosLevel, bool retain) { var publish = new MqttMsgPublish(topic, message, false, qosLevel, retain); publish.MessageId = connection.GetMessageId(); // enqueue message to publish into the inflight queue EnqueueInflight(connection, publish, MqttMsgFlow.ToPublish); return(publish.MessageId); }