title: Can't find out why MQTT python app isn't subscribing or receiving messages
body: <p>MQTT and flask app isn't receiving messages I'm not sure if it just isn't getting subscribed to, or if the message isn't being received by my device. Publishing messages worked I've tested it, but receiving them doesn't. Is there something I am doing wrong here.</p>
  
  <pre><code>from flask import Flask, render_template
  import paho.mqtt.client as mqtt
  import time
  
  def on_message(client, userdata, message):
      print((message.payload.decode("utf-8")))
  
  broker = "broker.hivemq.com"
  client = mqtt.Client("mypc")
  client.on_message=on_message 
  client.connect(broker)
  client.loop_start() 
  client.subscribe('class/ledToggle')
  
  app = Flask(__name__)
  
  @app.route("/")
  def index():
      return render_template('home.html')
  
  @app.route('/led/&lt;state&gt;')
  def led(state):
      if (state == "on"):
          client.publish('class/ledToggle','1')
      elif (state == "off"):
          client.publish('class/ledToggle','0')
      time.sleep(5)
      return render_template('led.html', title = 'Led')
  
  client.loop_stop()
  
  if __name__ == "__main__":
      app.run(debug=True)
  </code></pre>