1,588 questions
0
votes
0
answers
92
views
Django channels tutorial issue [closed]
As I am following the Django channels tutorial (here is the link:
https://channels.readthedocs.io/en/latest/tutorial/part_2.html
), I won't post any code except the specific problem I am having.
In my ...
2
votes
1
answer
54
views
htmx web socket extension not rendering server messages
I'm using the below to render model initial counts on load.
consumers.py:
from channels.generic.websocket import WebsocketConsumer
from django.template.loader import render_to_string
from myapp.models ...
0
votes
0
answers
50
views
Django Channels WebSocket consumer prevents synchronous API from updating database
class SessionTakeOverAPIView(generics.GenericAPIView):
"""
This API view allows a human or AI to take over a chat session.
The view handles session takeover validation, ...
0
votes
1
answer
63
views
Getting error message running Django server
I’m not able to run python manage.py runserver. I was able to run python manage.py migrate successfully. I even changed ASGI_APPLICATION = "MyProject.asgi.application" to ASGI_APPLICATION = &...
2
votes
1
answer
64
views
Should I Serve a React Build with Django or Use a Node.js Server if I am using Websockets with Django Channels?
I have a React application that I need to deploy, and I am considering two options for serving the production build:
1. Serving the React build directly with Django (e.g., using WhiteNoise or serving ...
0
votes
0
answers
32
views
Signals with Channels updating one value at the time
I'm using a m2m signal that triggers django channels, to create a realtime update on a value. It works fine but if I go to the admin and update more than one at the same time (having multiple tabs ...
0
votes
0
answers
20
views
Django Channels WebSocket: Messages Not Instantly Received on Login Without Refresh
'm using Django Channels, WebSockets, and Redis to build a real-time chat system. The problem is:
If a user sends a message while the admin is logged out, the admin sometimes receives it immediately ...
0
votes
0
answers
36
views
How to interact with Redis db from inside Django AsyncWebsocketConsumer
I am wanting to use Redis queues to store updates that are sent to the Websocket, so that disconnected players (offline) who become reconnected can then be sent the queued messages. I am using the ...
1
vote
1
answer
106
views
WebSocket Streaming Not Working in Django + Next.js — Only Getting First and Final Message
I'm building a ai chat app with Django (Channels) for the backend and Next.js for the frontend. The goal is to stream AI-generated responses chunk by chunk over a WebSocket connection — similar to how ...
0
votes
1
answer
36
views
Running simple async chatroom. Works fine in dev. Fails in Heroku
I've made an async chatroom app for a django website based on the excellent tutorial provided by django on django channels with daphne and redis.
https://channels.readthedocs.io/en/stable/tutorial/...
0
votes
0
answers
72
views
How Can I Get Django Global Notifications Via Channels To Work?
I have spent the last month or so on and off trying to get the django channels notification to work. I can't get notifications to work but the chat works as expected. Here is my code...
Consumers.py
...
0
votes
0
answers
241
views
Switching from WSGI to ASGI (Gunicorn + Uvicorn) in Django Production – Site Not Loading
I recently built a Django application using Django Channels for WebSocket support. My asgi.py is set up for handling both HTTP and WebSocket connections, and everything works perfectly in development ...
0
votes
0
answers
29
views
collaborative plateform Real time cursor problem in web socket
My problem is a cursor position in my project. When the web socket open and at setTimeout send code to the another connection room. then my cursor position and text is not showing currently and my ...
0
votes
0
answers
34
views
Having problem sending data between 2 scope classes in Django Channels
I am using django channels for the first time and can't wrap my head around something.
Here is what I am trying to achieve; I want to create a new message in ChatConsumer which is all good and fine. ...
0
votes
0
answers
44
views
Why is my Celery task stuttering when sending frequent progress updates with Django Channels?
I have a loop in a Django application where I process a list of records and send periodic progress updates to the frontend. I'm using async_to_sync from Django Channels to send messages through the ...
0
votes
0
answers
38
views
Django Channels: Maintaining WebSocket Authentication Across Multiple Consumers
I am developing a dashboard using Django Channels and have implemented two WebSocket consumers—UserConsumer and RequestConsumer—to handle user authentication and requests, respectively.
Problem
After ...
0
votes
0
answers
58
views
Sending serial port-data via websocket in Django framework
I need to visualize data on Django-based webserver; which data is captured on serial port, like a stream.
I use python **serial ** package to listen on the serial port, and I store these data in DB.
I ...
1
vote
0
answers
45
views
Python Django Channels provides error on startup on colleagues computer but not on my computer what is going wrong?
I have encountered the following error.
The weird thing about this error is that it does not occur on my windows 11 computer, but it only occurs on the windows 11 computer of a colleague and on a ...
0
votes
0
answers
39
views
How to properly set up django channels and websocket
I'm trying to implement websocket and django channels. On frontend I have react and on backend django.
I've installed channels and added it to INSTALLED_APPS in settings and I also added to settings....
1
vote
1
answer
79
views
Python async performance doubts
I'm running an websocket application through Django Channels and with Python 3.12. I have a ping mechanism to check if my users are still connected to my application where at a fixed time interval the ...
0
votes
1
answer
27
views
django asgi raised django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet
I want to build a Django app with django-channels.
But when I run the following command:
daphne -b 0.0.0.0 -p 8010 paya.asgi:application
It gives me this error: Apps aren't loaded yet.
This error ...
1
vote
0
answers
58
views
Sending messages to all user's devices with django channels
I have been developing project. It uses django channels for websockets. And I meet a problem with sending ws messages to all device of the same account that is logged in. It is not a rare situation ...
1
vote
0
answers
60
views
Django Channels - Route not found
I have been grinding on this from past 4 days and still couldn't get the websockets connected , it always shows Not found : ws/play/testroomcode
This is my consumers.py:
from channels.generic....
0
votes
1
answer
184
views
ValueError("Incoming message has no 'type' attribute") django channels
I wrote these codes with Django Channels, but it gives me an error:
These codes used to work correctly, but I don't know why they went wrong.
def receive(self, text_data=None, bytes_data=None):
...
1
vote
0
answers
96
views
Django Channels throwing raise ImproperlyConfigured("Cannot import ASGI_APPLICATION module %r" % path) error
I am working on a Django project that uses Django Channels, Daphne, and Django Tenants for multitenancy and WebSocket communication. My project structure includes a project folder and several ...
1
vote
0
answers
70
views
WebSocket disconnected with code: 1011 in django
consumers.py
import asyncio
import websockets
import sounddevice as sd
import vosk
import queue
from channels.generic.websocket import AsyncWebsocketConsumer
model_path = "vosk_model/vosk-model-...
0
votes
1
answer
50
views
Django Websocket Failing right after handshake if using PostgresSql
I developed the application using Django and I used Django channels in it for messages.
My websocket connections were working fine as soon as I was using my local db.sqlite3 but when I shifted to ...
0
votes
3
answers
113
views
How to send data returned from a function to client in Django in real time without the client need to refresh?
I am writing a program to retrieve data and display it in a Django template. I have a function called match_algo() that takes a long time to run. I want to initially show 'Loading...........' on the ...
1
vote
0
answers
55
views
Django channels stops working after some time
I have a system that has two forms of communication, one through http connections for specific tasks and another through websockets for tasks that require real-time communication.
For the deployment I ...
0
votes
1
answer
56
views
Unable to Get Redis Working with Django on Windows
I'm working on a Django Channels project that requires Redis as the channel_layer. However, I've discovered that Redis is not natively supported on Windows, as it's primarily designed for Linux ...
0
votes
0
answers
67
views
WebSocket Channels in Django not connecting
I'm struggling why still insist not being connected my WebSocket using Django, I've used laragon as Mysql and I just used my local database, and I just want to try first before saving to database it ...
0
votes
0
answers
60
views
How to connect multiple authenticated clients' with Django channels and clients should be connected before opening the channels?
So I'm working on a desktop based app that requires a socket to handle multiple authenticated clients with a Django channel, and clients should be authenticated by the server before opening the ...
0
votes
1
answer
135
views
django-channels integration tests with pytest?
I am trying to create a simple live-server style test fixture for pytest for testing with django-channels. I came up with the simplest solution:
import pytest
@pytest.fixture(scope="function"...
1
vote
1
answer
525
views
What is the purpose of using daphne with django channels?
What is the primary purpose of using Daphne with Django channels, if we can already do the ASGI configuration ourselves? What is the relationship between ASGI & Daphne server?
1
vote
1
answer
256
views
How to know user is online/offline with django channels?
With Django Channels, can you track which users are online or offline throughout your website? Should every page have a websocket connection? And when a user is online/offline, how can I show the user ...
5
votes
2
answers
395
views
WebSocket connection to 'wss://example.com/wss/' failed in Django Channels
I'm trying to set up a WebSocket connection using Django Channels in my Django project. However, I keep encountering an error when trying to connect from the frontend JavaScript. The error message in ...
0
votes
1
answer
138
views
TypeError: Group name must be a valid unicode string with length < 100 containing only ASCII alphanumerics, hyphens, underscores, or periods, not
import json
from asgiref.sync import async_to_sync
from channels.generic.websocket import WebsocketConsumer
from .models import User, Connection, Message
import logging
from .serializers import (
...
0
votes
1
answer
73
views
Django channels error:- Could not connect to ws://192.168.1.21:8000/ws/sc/,
IMO I think it is unable to find the route /ws/sc route but I dont understand why as I have linked it properly.
The error is give when I try to establish a connection using postman
Following is the ...
0
votes
1
answer
55
views
Django chat app sorted messages by datetime
i have a chat and Message Model. How can i sort my Chat with the creation_date of Message example:consider that i am in two chats(A and B): i want that everytime i receive a message from B so that B ...
0
votes
1
answer
50
views
Space is not sliced from my text in front-end
So here is my front-end JS code for the keyHandler:
let snippet = document.getElementById('snippet');
let remaining = document.getElementById('remaining');
let typed = document.getElementById('typed'...
0
votes
2
answers
434
views
Django Channels: Error UNKNOWN while writing to socket. Connection lost
We have Django Channels coupled with uvicorn and azure redis instance. Our sentry is getting swamped with errors such as:
Exception in ASGI application
ssd.consumers in disconnect
Error UNKNOWN ...
0
votes
1
answer
691
views
Django Channels, Set different WebSocket routing patterns for different paths
I am trying to implement a Django Projects with multiple Apps, with multiple Consumers with different WebSocket routing patterns for each paths.
Below is my working code, the code works, but is ...
0
votes
0
answers
81
views
WebSockets down stream is Rate-Limited Channels
We have a game which is running on our Django server. All calculations are made on the server.
We use WebSocket to communicate the game data to our front-end clients, which do the rendering.
But we ...
-1
votes
1
answer
772
views
wAssertionError: Expected a `Response`, `HttpResponse` or `StreamingHttpResponse` to be returned from the view, but received a `<class 'coroutine'>`
Source:
async def send_stock_updates(symbol):
while True:
stock_info = get_one_stock_info(symbol)
# Send stock info over WebSocket
channel_layer = get_channel_layer()
...
0
votes
1
answer
85
views
Apache websocket connection using daphne uploading django project
asg.py
import os
from django.urls import re_path
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.auth import AuthMiddlewareStack
from channels.security.websocket import ...
1
vote
1
answer
192
views
How to configure Daphne channels in Nginx server
I have a Django application that serves both http and websocket requests. The application is working properly in local. I have configured gunicorn and daphne services in Nginx server but Daphne ...
1
vote
0
answers
253
views
Why Django Signals async post-save is locking other async ORM calls?
I have a Django 5 application that use websockets using channels, and I'm trying to switch to AsyncConsumers to take advantage of asyncronous execution for I/O or external API tasks.
I already wrote a ...
1
vote
1
answer
338
views
Django Channels on IIS using FASTCGI
I am deploying a Django app using an IIS server. In this Django app, I have implemented Django Channels to use websockets. Locally, everything is working fine with websocket connections, and I am able ...
0
votes
1
answer
93
views
Django channels wss socket not working when deployed in AWS ec2 instance (Ubuntu 1.18.0) proxy server
In our Django project, we are using django channels with wss socket connection. While sending data via socket it is not working when deployed in AWS ec2 instance (Ubuntu nginx/1.18.0) proxy server.
...
0
votes
1
answer
232
views
How can I fix my Daphne, Redis, and Ngnix configuration to support websocket connections from my frontend client?
This is my current configuration on my digital ocean droplet:
Django, Django Channels, Daphne, Nginx, Gunicorn, HTTPS**
I am stuck trying to configure Redis, Daphne, and Nginx. I used this walkthrough ...