0

I successfully used Flask and Flask-Socketio with eventlet on Windows. I want to add async / await to access Oracle. As Miguel Grinberg said Flask-Socketio didn't support async / await. Need to use python-socketio which uses asyncio.

I successfully setup Flask with python-socketio in async_mode='threading'

sio = socketio.Server(async_mode='threading', logger=True, engineio_logger=True, cors_allowed_origins='*')

app.wsgi_app = socketio.WSGIApp(sio, app.wsgi_app, static_files=None, socketio_path='/QMOSDS/socket.io')

http://localhost:5000/QMOSDS/assets/images/QUAD-DS-logo-2.1.svg

http://localhost:5000/QMOSDS/socket.io/?EIO=4&transport=polling&t=OFMbSOj&sid=vY6aX2_07Gpk3-ZZAAAC http://localhost:5000/QMOSDS/api/Home/GetConfigurations (POST)

everything works well.

But I failed in async_mode='eventlet'

sio = socketio.Server(async_mode='eventlet', logger=True, engineio_logger=True, cors_allowed_origins='*')

socketio_app = socketio.WSGIApp(sio, app, static_files=None, socketio_path='/QMOSDS/socket.io')

eventlet.wsgi.server(eventlet.listen((HOST, PORT)), socketio_app)

405 Method not allowed because CORS allow methods: GET, HEAD, OPTIONS http://localhost:5000/QMOSDS/api/Home/GetConfigurations (POST)

If I changed to method "GET", then method is allowed but method not found

when call socketio.Server, how to set CORS allow methods? how to fix the method not found issue? Thanks!

0 Answers0