Flask-SocketIO Client: Event Handlers Not Logging or Debugging — Even With app.app_context() #1482
Replies: 1 comment
-
Unfortunately you are not providing sufficient details, but I think you must be making some incorrect assumptions.
Are the handlers running? What logging do you expect to see? Are you writing your own logging inside these handlers?
Strong indication that the handlers aren't running.
This does not really mean anything in the Celery worker. If you refer to Flask's debug mode, that is a server feature. The Celery worker isn't running a Flask server.
This is actually correct. Flask is a web server, it is not supposed to run in your Celery worker. The only reason you need a Flask app instance in the worker is to have access to the configuration, which I assume is needed by some of the Flask extensions you are using.
There is no such thing as "Flask + Celery". In the Celery worker you can use Flask extensions if you need them, but Flask itself does not do anything. And with respect to Socket.IO, I believe you said this is a Socket.IO client, correct? The Socket.IO client has absolutely no knowledge of Flask, it does not need nor use Flask for anything. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Miguel,
Thanks for your work on Flask-SocketIO — it’s been really helpful.
I’m using socketio.Client inside a Celery worker, where Flask is initialized only to support SQLAlchemy models. There are no Flask routes or HTTP requests — this is a pure client-side use case. All event handlers are triggered by incoming Socket.IO messages handled inside Celery.
Here’s the issue I’m facing:
So my question is:
Any suggestions or best practices would be greatly appreciated.
Thanks again for your time,
Beta Was this translation helpful? Give feedback.
All reactions