miguelgrinberg / Flask-SocketIO

Socket.IO integration for Flask applications.
MIT License
5.31k stars 888 forks source link

Support for once to listen for an event only 1 time (Like official socket.io server has) #1997

Closed kingdevnl closed 6 months ago

kingdevnl commented 1 year ago

Is your feature request related to a problem? Please describe. For example to request user input from a socket and to only handle the output once.

Describe the solution you'd like Sending a event to the client requestInput -> {"title": "Enter name of file"} then in the client ask for input, then send the the respsonse to the server In the server write the data to for example redis.

Additional context Add any other context or screenshots about the feature request here.

miguelgrinberg commented 1 year ago

Unlike the JavaScript libraries, these use a more Pythonic approach based on decorated event handlers and do not allow adding and removing event handlers while the application is running. You set up your handlers before the server start, and then those handlers remain active. With this in mind, I think it isn't really clear how to implement what you are asking.