Open Rz-Rz opened 2 months ago
I want to add the yield functionality to the webserver, any one can point me to where to start ?
Ok I see 2 main problems here, the first (and not critical one) is the fact that crow's handlers are blocking, meaning while you're waiting for a valid frame to come, you cannot do anything else with that thread, but Crow's async functionality is another massive can of worms i don't wanna open.
The second issue is the way crow handles http connections, basically it's read_request -> parse_request -> run_handler -> send_response -> repeat
this means that the handler is simply a function you put between the read and write that takes a request and sends a response.
theoretically speaking, you would need to bypass this loop and use the connection to send the response data without triggering the read
part of the loop.
IIRC I was working on something similar a long time ago but ultimately gave up, please check out the res-push
branch.
Please keep in mind this was in my early days of working on Crow and I largely had no idea what I was doing.
I'd be happy to assist you in any way I can to get this feature going
Hello, I'm trying to implement MJPEG streaming using Crow. I had an example working with flask and I tried to convert it to Crow. This is the code I add in flask :
I am generating the image stream using GStreamer and my webcam :
I tried to implement the following in Crow :
I seem to not be able to load images, as the browser is constantly refreshing without showing any image. When I access http://localhost:5000/streaming/jpeg/test1 I get redirected to the index on /.
EDIT: I believe the problem lies here: Crow's HTTP response model is different from Flask's, and it requires that the response is returned and completed at the end of the route handler. Crow does not have a direct equivalent to Flask's yield, which allows for continuous response streaming.