title: Flask socket.io not working in thread
body: <p>I have a python server which runs a thread and emits a signal via websocket:</p>
  
  <pre><code>def read_serial():
     while True:
        ...
        socketio.emit("fire", {'n': 1},  namespace='/test')
  
  
  app = Flask(__name__)
  app.config['SECRET_KEY'] = '32ed21l31f9031kd93'
  app.debug = True
  socketio = SocketIO(app)
  ...
  @socketio.on('connect', namespace='/test')
  def test_connect():
      emit('my response', {'data': 'Connected'})
  ...
  if __name__ == '__main__':
      thread = Thread(target = read_serial)
      thread.start()
      socketio.run(app, use_reloader=True)
  </code></pre>
  
  <p>On the client side I have the next code:</p>
  
  <pre><code>    var socket = io.connect('http://' + document.domain + ':' + location.port + "/test");
  
  socket.on('fire', function(data){
      fireTimer(data.n);
  });
  </code></pre>
  
  <p>Connection is working, but events are not being fired as supposed to do.</p>