Comments (7)
I cannot reproduce. I have added a test based on your code to this repository to confirm that background tasks are working fine. See 84562cf.
Maybe your background task is crashing for some reason and does not run to completion?
from flask-socketio.
@miguelgrinberg thank you for your quick response. It does not work even my background job contains just logger call:
@socketio.on('connect', namespace='/namespace')
def handle_connect():
def background_task():
app.logger.info('Background task started')
socketio.start_background_task(background_task)
Additional info:
platform linux -- Python 3.8.11, pytest-6.2.5
from flask-socketio.
You can confirm yourself that a similar test just added to this repository passes. I'm really not sure how I can help, given that I cannot debug an issue that I cannot reproduce. You can compare your testing procedures against mine in this repository to help you determine what is causing this.
from flask-socketio.
@miguelgrinberg got it. I'll try to compare and debug more deeply. I'll send feedback as soon as I find the reason.
from flask-socketio.
@miguelgrinberg, our application uses eventlet
async mode, so that's one difference when issue is reproducible.
app = Flask(__name__)
socketio = SocketIO(
logger=True,
engineio_logger=True,
async_mode='eventlet'
)
socketio.init_app(app=app)
I tried different versions of eventlet
but it does not help.
from flask-socketio.
@al-awsdev4 If you are using eventlet during your test run you need to ensure that all the packages that you use to support your tests are compatible with eventlet style concurrency. Not sure which test runner you are using, but I have no idea if unittest, pytest, nose, etc. can be used safely with eventlet. Even if you were able to make your tests work fine in the past, supporting eventlet for unit tests has never been a goal.
from flask-socketio.
@miguelgrinberg, thank you for clarifying. Issue can be closed since it's not related to Socket.IO test client.
from flask-socketio.
Related Issues (20)
- Support for once to listen for an event only 1 time (Like official socket.io server has) HOT 1
- Error when using gevent with allow_unsafe_werkzeug HOT 2
- Option to redirect http to https instead of raising errors HOT 1
- Strange Behavior with RabbitMQ and Flask-SocketIO HOT 4
- get_received(namespace=None) does not returns the messages HOT 5
- Add type hints HOT 9
- gevent - cannot enter into function. HOT 1
- Multiple SocketIO instances connected to the same Flask server HOT 1
- python-engineio and python-socketio version matching with Flask-SocketIO >= 5.3.0 HOT 1
- Flask-SocketIO cannot run in ws HOT 1
- pyinstaller Packaging error HOT 1
- How do I intercept event events and authenticate them in a unified manner?
- Waiting for client events leads to timeouts
- Sending events in a separate thread with delays does not send HOT 1
- Sending high volume of packets in short amount of time causes packets dropping HOT 5
- Namespace catch-all handling? HOT 9
- Namespace catch-all handling of connect/disconnect events HOT 1
- Flask-SocketIO returns [] on `get_received` function call HOT 10
- Is Eventlet Still The Best Option? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-socketio.