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
18
votes
1 answer

Django Channels VS Django 3.0 / 3.1?

Can someone clarify the differences or complementarities between Django Channels Project and new Django native async support? From what I understood, Django-Channels is a project that have been started outside of Django, and then, started to be…
David Dahan
  • 10,576
  • 11
  • 64
  • 137
18
votes
2 answers

How to profile django channels?

My technology stack is Redis as a channels backend, Postgresql as a database, Daphne as an ASGI server, Nginx in front of a whole application. Everything is deployed using Docker Swarm, with only Redis and Database outside. I have about 20 virtual…
Valar
  • 1,833
  • 1
  • 16
  • 18
18
votes
6 answers

Sending a message to a single user using django-channels

I have been trying out django-channels including reading the docs and playing around with the examples. I want to be able to send a message to a single user that is triggered by saving a new instance to a database. My use case is creating a new…
lukeaus
  • 11,465
  • 7
  • 50
  • 60
17
votes
2 answers

Took too long to shut down and was killed

WARNING Application instance wait_for=._call_check_cancel() at…
Susaj S N
  • 960
  • 1
  • 10
  • 22
17
votes
3 answers

Sending messages to groups in Django Channels 2

I am completely stuck in that I cannot get group messaging to work with Channels 2! I have followed all tutorials and docs that I could find, but alas I haven't found what the issue seems to be yet. What I am trying to do right now is to have one…
Måns Thörnvik
  • 1,038
  • 2
  • 10
  • 22
16
votes
1 answer

Django — async_to_sync vs asyncio.run

We can use both functions to run any async function synchronously: import asyncio from asgiref.sync import async_to_sync asyncio.run(asyncio.sleep(1)) async_to_sync(asyncio.sleep)(1) What is the difference? Can we always use asyncio.run instead of…
Max Malysh
  • 29,384
  • 19
  • 111
  • 115
16
votes
1 answer

Run simultaneously UWSGI and ASGI with Django

I'm currently running a Django (2.0.2) server with uWSGI having 10 workers I'm trying to implement a real time chat and I took a look at Channel. The documentation mentions that the server needs to be run with Daphne, and Daphne needs an…
Pyvonix
  • 757
  • 9
  • 22
16
votes
8 answers

Django Channels Error - Cannot import BACKEND 'asgi_redis.RedisChannelLayer'

I have installed Django-Channels but while running the daphne-server I am getting this error given below: File "/usr/local/lib/python2.7/dist-packages/channels/asgi.py", line 36, in make_backend "Cannot import BACKEND %r specified for %s" %…
Utkarsh Sinha
  • 941
  • 2
  • 11
  • 30
15
votes
0 answers

Django channels with Spring Boot Websockets (StompSession) do not work

Hey there we want to use Django just to execute python code and use channels for the results. Implemented everything the websockets are not working as they should. If I try to send something from our Angular frontend to Django it works fine. And…
CptDayDreamer
  • 1,526
  • 6
  • 25
  • 61
15
votes
1 answer

Sending data to django channels groups via django views

TL;DR Want this flow: ws://... websocket client 1 <-----------> websocket client 2 ^ | server (send messages via views) So I have the following:…
Adarsh
  • 3,273
  • 3
  • 20
  • 44
15
votes
3 answers

Constantly send data to client from server

Take a look at this example. As you can see, some sort of event is constantly being sent to the client. I want to imitate this using Django-Channels, inside consumers.py. Here's a simplified version of what I have: class…
Eric Kim
  • 2,493
  • 6
  • 33
  • 69
15
votes
4 answers

Protocol error, got "H" as reply type byte

I am trying to use django channels for the first time and i am following the tutorial in the documentation. But when I use python manage.py runserver and try to connect i get this error. Protocol error, got "H" as reply type byte Here is the whole…
ranjith
  • 195
  • 2
  • 2
  • 8
14
votes
6 answers

ASGI_APPLICATION not working with Django Channels

I followed the tutorial in the channels documentation but when I start the server python3 manage.py runserver it gives me this : Watching for file changes with StatReloader Performing system checks... System check identified no issues (0…
14
votes
1 answer

How many concurrent connections can django-channels handle?

I am using Django channels for chat application. This application might scale to 100k concurrent users in some amount of time. I am wondering how many concurrent connections can Django Channels handle. Basically, what I am comparing it with is XMPP…
hardik24
  • 1,008
  • 1
  • 11
  • 34
14
votes
2 answers

New chat message notification Django Channels

I've got Django Channels 2.1.2 set up in my Django app by following a tutorial and now need to set up a notification system for new messages. I want to do this in the simplest way possible. I can do it via browser push notifications, but I don't…
Trilla
  • 943
  • 2
  • 15
  • 31