Questions tagged [django-channels]

Should be used for the django-channels project that brings asynchrony (WebSockets and HTTP2) to django.

Channels is a project that takes Django and extends its abilities beyond HTTP - to handle WebSockets, chat protocols, IoT protocols, and more.

Documentation

1583 questions
70
votes
9 answers

How do you authenticate a websocket with token authentication on django channels?

We want to use django-channels for our websockets but we need to authenticate as well. We have a rest api running with django-rest-framework and there we use tokens to authenticate a user, but the same functionality does not seem to be built into…
ThaJay
  • 1,758
  • 1
  • 19
  • 30
33
votes
1 answer

Unable to get results from Google text to speech api while streaming audio from web

I want to stream audio from the web and convert that to text using Python Google-cloud-speech API. I have integrated that in my Django channels code. For frontend, I have directly copied this code and the backend has this code (please see below).…
31
votes
2 answers

Disadvantages of using ASGI instead of WSGI

What is the explicit and clear disadvantages of using ASGI instead of WSGI for HTTP request handling in Django in general? I know ASGI is for asynchronous tasks, but it can also handle synchronous HTTP requests via http.* channels. Is it slower than…
Analysis
  • 377
  • 1
  • 4
  • 8
28
votes
3 answers

Django - How to track if a user is online/offline in realtime?

I'm considering to use django-notifications and Web Sockets to send real-time notifications to iOS/Android and Web apps. So I'll probably use Django Channels. Can I use Django Channels to track online status of an user real-time? If yes then how I…
Fabio
  • 1,272
  • 3
  • 21
  • 41
27
votes
19 answers

Cannot import ASGI_APPLICATION module while runserver using channels 2

I have followed the channels tutorial but while running these error throw Version of the packages is channels==2.1.2 Django==2.0.4 what I missed ? in settings.py INSTALLED_APPS = [ "channels" .... ] ROOT_URLCONF =…
Shihabudheen K M
  • 1,347
  • 1
  • 13
  • 19
26
votes
3 answers

Send message using Django Channels from outside Consumer class

I am building an online game, which uses Django channels 2.1.5 for websockets. I am able to build the connection between the client and the server, and also able to send data between them only inside the consumer class: from…
Ahmed Hammad
  • 2,798
  • 4
  • 18
  • 35
26
votes
3 answers

Using django signals in channels consumer classes

I am trying to develop an auction type system, where a customer makes an order, and then different stores can offer a price for that order. An interesting part of this system is that when the order is initially created, the available stores will…
jhc
  • 1,739
  • 3
  • 21
  • 46
22
votes
3 answers

Django Channels Nginx production

I have a django project and recently added channels to use websockets. This seems to all work fine, but the problem I have is to get the production ready. My setup is as follows: Nginx web server Gunicorn for django SSL enabled Since I have added…
Harry
  • 13,091
  • 29
  • 107
  • 167
22
votes
5 answers

Load spike protection for Django Channels

Is there anything specific that can be done to help make a Django Channels server less susceptible to light or accidental DDoS attack or general load increase from websocket/HTTP clients? Since Channels is not truly asynchronous (still workers…
Jamie Counsell
  • 7,730
  • 6
  • 46
  • 81
21
votes
1 answer

VueJS + Django Channels

I just finished reading the introductions for VueJS and Django Channels and would like to use them together to provide real-time updates to several components on a webpage. This illustrates the basic idea: Being new to VueJS, it seems the diagram…
fire_water
  • 1,380
  • 1
  • 19
  • 33
20
votes
11 answers

Redis ERR unknown command 'BZPOPMIN'

I installed Redis version 4.0.9 in a Ubuntu Linux Subsystem on Windows 10 by following these instructions (i.e. sudo apt-get install redis-server). I am following this tutorial on Django channels, and I ran the following code: >>> import…
Software Dev
  • 910
  • 3
  • 10
  • 27
20
votes
3 answers

Django apps aren't loaded yet when using asgi

I'm tring to run my django project with usage of asgi instead of wsgi. I have set up my routing.py and asgi.py as follows: routing.py from django.conf.urls import url from channels.routing import ProtocolTypeRouter, URLRouter from…
kebie
  • 485
  • 5
  • 16
19
votes
0 answers

Can django channels scale to handle big traffic?

I want to use django channels on an existing project to support websockets, but i'm having doubts about scalability i know daphne server can only handle so much opened connections 1-how many simultaneous connection can one daphne instance…
Zingo
  • 191
  • 1
  • 5
19
votes
3 answers

Session authentication with Django channels

Trying to get authentication working with Django channels with a very simple websockets app that echoes back whatever the user sends over with a prefix "You said: ". My processes: web: gunicorn myproject.wsgi --log-file=- --pythonpath…
lollercoaster
  • 15,969
  • 35
  • 115
  • 173
18
votes
1 answer

TypeError: __call__() missing 1 required positional argument: 'send' Django

When I run the project through the gunicorn (command: gunicorn --bind :8000 myproject.asgi:application), I get this error. Error Traceback (most recent call last): File "/venv/lib/python3.8/site-packages/gunicorn/workers/sync.py", line 136, in…
Sultan Syidaliev
  • 181
  • 1
  • 1
  • 3
1
2 3
99 100