title: python paho-mqtt - Not receiving mqtt messages
body: <p>I am developing a python app that should receive mqtt messages. I'm using paho-mqtt library.</p>
  
  <p>After setting the username/password and the callback function <code>on_message</code> , I subscribe to the topic and make the connection to the broker. Then I start the <code>loop_forever()</code>.</p>
  
  <p>Here is my code:</p>
  
  <pre class="lang-py prettyprint-override"><code>import paho.mqtt.client as mqtt
  
  MQTT_TOPIC = "my_topic"
  BROKER_ENDPOINT = "my_broker_url"
  BROKER_PORT = my_port
  BROKER_USERNAME = "my_username"
  BROKER_PASSWORD = "my_password"
  
  mqtt_client = mqtt.Client()
  
  def on_message(client, userdata, message):
     print("Message Recieved from broker: " + message.payload)
  
  def main():
      mqtt_client.username_pw_set(username=BROKER_USERNAME, password=BROKER_PASSWORD)
      mqtt_client.on_message = on_message
      mqtt_client.connect(BROKER_ENDPOINT, BROKER_PORT)
      mqtt_client.subscribe(MQTT_TOPIC)
      mqtt_client.loop_forever()
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>I'm testing this code with the <code>mosquitto_pub</code> command:</p>
  
  <p><code>mosquitto_pub -h my_broker_url -p my_port -u my_username -P my_password -t 'my_topic' -m "Hello World"</code></p>
  
  <p>But I cannot see any messages received by my application.</p>
  
  <p>What am i doing wrong ? 
  Thanks for helping</p>