Replies: 1 comment 10 replies
-
Socket.IO doesn't really work in the way you describe. What you can do is have the server notify the client when the counter has changed. The notification can include the new value of the counter. On the Python side this would be something like this: socketio.emit('new_counter', counter) Then the client can define a handler for the socketio.on('new_counter', (counter) => {
// do something with counter here
}); |
Beta Was this translation helpful? Give feedback.
10 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I'd like to push an updating variable from my app.py. I have a form on a page which accepts a list, and then with that list my Python queries it line by line, and updates a variable called "counter" with which line it's on. I'd like to send this variable to JavaScript in order for it to return information to the page (primarily a progress bar) on how the application is doing.
Is there a simple way to do this with flask-socketio? Here's a simple idea of the code:
Then I have JS for the progress bar:
Finally on my check.html I have the progressbar:
Many thanks
Beta Was this translation helpful? Give feedback.
All reactions