Giter Site home page Giter Site logo

Comments (4)

shanealynn avatar shanealynn commented on August 21, 2024

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.

sergeos avatar sergeos commented on August 21, 2024

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.

shanealynn avatar shanealynn commented on August 21, 2024

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.

diff3 avatar diff3 commented on August 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.