Comments (4)
To achieve this, I think you will need to manually keep a count of the number of clients connected in your Python application. On each new client, you will receive a "connect" event, and when they leave, a "disconnect" event - you can implement a counter based on this, and then stop the random generation based on the counter.
Does that make sense?
from async_flask.
But which of command terminate generator?
i'm trying
'''
@socketio.on('disconnect', namespace='/test')
def test_disconnect():
print('Client disconnected')
thread._stop()
'''
but thread._stop() crash my app.
And how to write correctly?
from async_flask.
I think you're on the right track - but you may need to add some sort of more complex object that is managing the thread activities so that you can pause it.
from async_flask.
It's working fine, I've just updated to this versions:
jquery: 3.6.0
socket.io: 4.0.0
bootstrap: 4.6.0
Python 3
Flask==1.1.2
Flask-SocketIO==5.0.1
Jinja2==2.11.3
python-engineio==4.0.1
python-socketio==5.1.0
example running without error
from async_flask.
Related Issues (13)
- this code is not working HOT 4
- Would you mind adding a license to this repo? HOT 2
- example doesn t work HOT 2
- application.js file gets a net::ERR_ABORTED 404 (Not Found) HOT 3
- get incoming request HOT 1
- thread.isAlive() is deprecated HOT 1
- unsupported version of the Socket.IO HOT 4
- Python 3.9 now defunct HOT 1
- gevent version HOT 1
- Python 3.5 version HOT 6
- Not working on Chrome? HOT 4
- Only the first random generated number is shown, very slow to show new numbers HOT 4
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 async_flask.