Giter Site home page Giter Site logo

Comments (5)

themagicalmammal avatar themagicalmammal commented on June 12, 2024

Issue References

  1. #413

I initially has a async_to_sync bug which got fixed by updated django to the latest lts version (4.2.5). But the generator still seems to be a issue. I have faced caroutine bug while trying to tackle this as well.

from daphne.

carltongibson avatar carltongibson commented on June 12, 2024

Yes, you need to use Django 4.2's support for async streaming responses (using an async generator).

from daphne.

themagicalmammal avatar themagicalmammal commented on June 12, 2024

I have converted to code to async generator and now it works fine. But I think we should have some way to convert a sync generator to async generator or add support for sync generator in StreamHTTPResponse.

from daphne.

themagicalmammal avatar themagicalmammal commented on June 12, 2024

I am closing this issue for now but I think we should look into one of those things I mentioned above.

from daphne.

carltongibson avatar carltongibson commented on June 12, 2024

@themagicalmammal Glad you've resolved your issue.

I'm afraid there's no magic way to convert sync iterators to async iterators. As per the Django docs on this topic, you need to adapt the generator passed to your response depending on whether you're running under WSGI or ASGI. (Alas the abstraction breaks down at this point.)

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.