title: flask socketio CORS
body: <p>I've been trying to send data from flask over socket io. I need to access this data from a different origin, but it is giving a CORS error. I have tried using all kinds of cross origin stuff and none of it has worked. Can somebody help with this.</p>
  
  <p>The view that should be called thought socket io:</p>
  
  <pre><code>from flask.ext.cors import cross_origin
  @socketio.on('increment',namespace="/api")
  @cross_origin()
  def increment(message):
      number += 1;
      emit('number',{'data':number},broadcast=True)
  </code></pre>
  
  <p>Running the server:</p>
  
  <pre><code>app = Flask(__name__)
  cors = CORS(app,resources={r"/api/*":{"origins":"*"}})
  socketio = SocketIO(app)
  app.debug = True
  app.host = '0.0.0.0'
  
  socketio.run(app)
  </code></pre>