flask-socketio-celery-example | Example based on Miguel Grinberg | Platform As A Service library
kandi X-RAY | flask-socketio-celery-example Summary
kandi X-RAY | flask-socketio-celery-example Summary
Using Celery with Flask-SocketIO.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of flask-socketio-celery-example
flask-socketio-celery-example Key Features
flask-socketio-celery-example Examples and Code Snippets
Community Discussions
Trending Discussions on flask-socketio-celery-example
QUESTION
I am trying to develop a web application that supports a long task at the backend. I am using flask-socketio
package on my server along with celery. My workflow is following :
- When a client opens the Html page -- I initiate a socket connection to the server which creates a uid for the user and emits it back.
- Now once the user posts a request for the long task -- I schedule it using celery and once finished I need to emit it to the user who posted the request. (I stored the relevant userid in post request)
I have looked at @Miguels's answer for 39423646/flask-socketio-emit-to-specific-user which creates a separate room for each user and then broadcasts the message on that room. But I wanted to ask if there is some other simpler way to do this since it seems inefficient or forced way to do this.
I also came across the nodejs solution (how-to-send-a-message-to-a-particular-client-with-socket-io) which I felt to be a more natural way to accomplish this. Is there a similar solution in python-socketio too?
Update: After some more search I came across the following solution on a github gist. According to this -- ** flash-socketIO already puts all clients in the separate room given by request.sid
**.
I would still wish to discuss other ways to do this. Specifically if the site traffic is quite high -- wouldn't it lead to too many rooms?
Update (2): my current (working) server code which makes use of rooms. This is borrowed and modified from flask-SocketIO celery example
...ANSWER
Answered 2021-Mar-13 at 08:50You can make a room for every separate user. And you can emit to a particular room which user you want to share the message.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install flask-socketio-celery-example
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page