I'm trying to run a Flask application with SocketIO using uWSGI and gevent.
uwsgi --gevent 10 --socket :5000 --module run
However, I get the following error:
invalid request block size: 21573 (max 4096)...skip
This is my code:
from gevent import monkey
monkey.patch_all()
from flask import Flask, render_template, session, request
from flask.ext.socketio import SocketIO, emit, disconnect
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
application = app
socketio = SocketIO(app)
@app.route('/')
def index():
session['user'] = '1'
return render_template('index.html', name='simon')
@socketio.on('my event', namespace='/test')
def test_message(message):
emit('my response', {'data': message['data']})
@socketio.on('connect', namespace='/test')
def test_connect():
emit('my response', {'data': 'Connected %s' % session['user']})
@socketio.on('disconnect', namespace='/test')
def test_disconnect():
print('Client disconnected')
if __name__ == '__main__':
app.debug = True
socketio.run(app)