Giter Club home page Giter Club logo

Comments (7)

ilayasis avatar ilayasis commented on June 10, 2024

Edit with more info

from daphne.

carltongibson avatar carltongibson commented on June 10, 2024

Async support for StreamingHTTPResponse is being added in Django 4.2.

from daphne.

ilayasis avatar ilayasis commented on June 10, 2024

Async support for StreamingHTTPResponse is being added in Django 4.2.

Hi, tnx for the quick response, Django 4.2 version by the docs is UNDER DEVELOPMENT and I looking for a solution for right now.

from daphne.

carltongibson avatar carltongibson commented on June 10, 2024

Then you'd need to patch The response object (and asgi handler) in Django.

If you find the commit in Django you can get the patch you need.

from daphne.

ilayasis avatar ilayasis commented on June 10, 2024

I'm actually not familiar with how to do it actually, u have some suggestions on how I can do it in my code?

from daphne.

ilayasis avatar ilayasis commented on June 10, 2024

Or maybe you have some idea which library I can use in Django if want to create a socket, in the end, my goal is to "listen" for only one variable.
the consumer that In my code for now it's just for the example.

from daphne.

themagicalmammal avatar themagicalmammal commented on June 10, 2024

You have to make the whole code async so test with a initial for loop and yield function and slowly start adding more code to it. And split it into more functions and use await with run_in_executor to make the sync code kind of like a async function.

And cap has to be used like

with concurrent.futures.ThreadPoolExecutor():
    while cap.isOpened():
        success, frame = await asyncio.to_thread(cap.read)

else you will get the async_generator error.

from daphne.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.