Questions tagged [asgi]

ASGI stand for Asynchronous Server Gateway Interface (ASGI), a "spiritual successor to WSGI, intended to provide a standard interface between async-capable Python web servers, frameworks, and applications."

An ASGI app is a a double, asynchronous callable (scope and coroutine). The callable has send and receive awaitables, thus the ability to wait for incoming events and send outgoing events. Events essentially are dictionaries with a predefined format that form the basis of the standard.

Official ASGI documentation

111 questions
1
vote
2 answers

On a machine running Sophos, why do all my browsers fail to receive server sent events (sse) from my Python apps in realtime?

My ASGI app sends events fine to curl, and to my phone. However, even though the server is sending the events, and the headers look right, neither Firefox nor Chrome on my Windows machine receives the events until the connection is closed. This…
jdbow75
  • 388
  • 1
  • 8
1
vote
1 answer

Django Channels consumer consuming 1 call twice

I am using a combination of DRF 3.11.0 and Channels 2.4.0 to implement a backend, and it is hosted on Heroku on 1 dyno with a Redis resource attached. I have a socket on my React frontend that successfully sends/received from the backend server. I…
JayBee
  • 411
  • 1
  • 3
  • 18
1
vote
1 answer

Django await on a function with @database_sync_to_async decorator for fetching multiple object throws error

I am integrating django channels for async capabilites. I am trying to fetch multiple objects of a user model using await on the function. consumers.py class TeamConsumer(AsyncConsumer): async def websocket_connect(self, event): await…
Arsh Doda
  • 144
  • 1
  • 9
1
vote
0 answers

How to proxy both WSGI and ASGI via Uvicorn or Daphne with nginx and SSL proxy?

I have a small project that uses Django Channels (websockets) and it works fine locally. I've added SSL to my docker-based deployment with the letsencrypt-companion-container docker image, which, exposes 443, handles all the SSL, then funnels…
mkoistinen
  • 7,480
  • 3
  • 34
  • 55
1
vote
1 answer

Groups and channel layers make the process stop without raising exceptions

Starting with this very simple working code sample: from channels.generic.websocket import JsonWebsocketConsumer class IsacomptaManagementFeesConsumer(JsonWebsocketConsumer): pass When connecting to this websocket consumer from javascript,…
Antoine Pinsard
  • 24,710
  • 7
  • 51
  • 79
1
vote
2 answers

Starlette + asyncio.create_task() doesn't log error if task object is stored in instance variable

Okay, this is very weird, but here goes - import asyncio from starlette.applications import Starlette class MyTasks: def __init__(self): self.task = None async def main(self): self.task =…
Dev Aggarwal
  • 3,725
  • 1
  • 24
  • 35
1
vote
1 answer

Run multiple asgi apps in same thread with uvicorn

I want to run a starlette and django app in the same thread. (Having them in same thread allows fast thread-local communication between them). Considering that asgi apps are just coroutines, I thought this should be theoretically possible with…
Dev Aggarwal
  • 3,725
  • 1
  • 24
  • 35
1
vote
1 answer

django channels vs daphene

I am little bit confused about the main roles of django-channels and uvicorn server. I have read a lot of blogs but did not get much clarification. If we can implement an ASGI server for websockets using channels, then why do we need asgi server…
gar
  • 109
  • 1
  • 6
1
vote
1 answer

How to fix the issue "django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet"?

I have deployed my django webapp to my heroku server and it was working fine until I added a websocket connection that shows the contents of a model object in a separate url as soon as that object is created. For this, I used Django channels with a…
1
vote
2 answers

How to use telethon with hypercorn?

Telethon with quart How to use telethon with hypercorn? How to convert the following line app.run(loop=client.loop) In procfile, how to pass the loop hypercorn file:app -k asyncio Or how to use hypercorn api? import asyncio from hypercorn.asyncio…
Smart Manoj
  • 3,837
  • 2
  • 24
  • 45
1
vote
1 answer

Quart Bad Request syntax or unsupported method

Python 3.7 on windows When running the sample from quart from quart import Quart, websocket app = Quart(__name__) @app.route('/') async def hello(): return 'hello' @app.websocket('/ws') async def ws(): while True: await…
Smart Manoj
  • 3,837
  • 2
  • 24
  • 45
1
vote
0 answers

How to access the HTTP/2 stream id in the send callable to the asgi app?

I'm building an ASGI application server in python and implementing the HTTP/2 protocol. I receive raw bytes from a socket, parse the bytes and convert them into frame objects. When I trigger the ASGI application the send callable only gets an event…
1
vote
3 answers

Django Channels Worker is returning TypeError: zadd() got an unexpected keyword argument 'daphne

In my server, i am running a Daphne and a Worker for Django Channels. I have already reboot all containers (I use Docker), cleaned Redis Cache. Today, these applications stoped to work and return this stack: KeyError: 'leads-198' 2019-03-27…
0
votes
0 answers

what are the closer relations between those terms [ASGI, WSGI, Channels, WebSockets]?

I'm confused with these subjects: [ASGI, WSGI, Channels, WebSockets] I know a little about socket in python but when I do any kind of searches always I see articles talking about these three terms [ASGI, WSGI, Channels] so, I figured later that…
Medo Abdin
  • 101
  • 1
  • 8
0
votes
1 answer

django async support - not fully understanding the main concept

which is main concept of django asgi? when there are multiple tasks to be done inside a view, handle those multiple tasks concurrently thus reduce view's response time. when there are multiple requests from multiple users at same time, hendle…
minkoonim
  • 5
  • 2