question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement HTTP generic consumers

See original GitHub issue

The HTTP event spec in ASGI is a little complex, and it would be nice to have an Async-capable generic consumer for HTTP to allow easier writing of long-poll applications. Something like:

class LongPoller(AsyncHttpConsumer):
    async def request(self, body):
        await asyncio.sleep(10)
        await self.send_response(200, "foo")

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
andrewgodwincommented, Feb 28, 2018

I believe we even have tests that check that more_body support works in Channels, it’s just not implemented in the server yet. But we want it to work once it is.

1reaction
matthiaskcommented, Feb 28, 2018

@hishnash Yes. The implementation was not my idea, similar code exists in channels/http.py already: https://github.com/django/channels/blob/6afd423/channels/http.py#L180

Read more comments on GitHub >

github_iconTop Results From Across the Web

Consumers — Channels 4.0.0 documentation
Much like Django's generic views, Channels ships with generic consumers that wrap common functionality up so you don't need to rewrite it, specifically...
Read more >
c# - Generic .Net Producer/Consumer - Stack Overflow
Use generics for the produced and consumed types (input, queued task, and output types, or any combination thereof); Allow you specify how many...
Read more >
How to use Java's functional Consumer interface example
Implement a Consumer with a Java class. Here is the Java Consumer function implemented using a Java class instead of a lambda expression:...
Read more >
Generic Customer API
Purpose: Use the generic customer API to add or change customers based on XML ... format: http://server:port/SerenadeSeam/sxrs/SerenadeREST/CWCustomerIn, ...
Read more >
generic-message-consumer/IMessageHandler.java at master
Copyright 2018 Karlsruhe Institute of Technology. *. * Licensed under the Apache License, Version 2.0 (the "License");. * you may not use this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found