flask-sse | Server-Sent Events for Flask
kandi X-RAY | flask-sse Summary
kandi X-RAY | flask-sse Summary
Server-Sent Events for Flask
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of flask-sse
flask-sse Key Features
flask-sse Examples and Code Snippets
Community Discussions
Trending Discussions on flask-sse
QUESTION
I'm refactoring a project to move from Flask with flask-socketio to FastAPI with async. Two main reasons for this are to stop using threads to do what async can do, and also to keep in line with other developers at work. Client side is React with Redux.
Trying to set up a basic 'heartbeat' on the server-side that sends a 0/1 signal each second to all clients. Can't seem to figure out how to do it. I have tried using the StreamingResponse() method, but it just waits for the function given to complete then sends a whole stack of ones and zeros.
Any ideas on how to set up an 'always running' function with FastAPI that live streams simple data? I have 3 functions that need to do this.
I've also looked into flask-sse, but it requires redis, which I'd rather avoid.
...ANSWER
Answered 2020-May-22 at 21:48Not a real solution for the question, but sockets might be unavoidable. Since I'm using FastAPI anyway, I'll just use the 'built-in' web sockets. I followed @Thomasleveil and have a nicely functioning app now.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install flask-sse
No Installation instructions are available at this moment for flask-sse.Refer to component home page for details.
Support
If you have any questions vist the community on GitHub, Stack Overflow.
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