All Questions
Tagged with websocket django-channels
580
questions
0
votes
0
answers
29
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
36
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 ...
1
vote
1
answer
64
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 ...
0
votes
0
answers
28
views
how to Implement non-blocking, sequential AI moves in a multiplayer chess game in django channels?
I'm developing a website to play a special with kind of chess with React and Django.
It pretty much requires two games to be played at the same time. The website allows to add AI players, so the ...
0
votes
0
answers
23
views
The caller tried using channels rabbitmq on a different event loop than the one it was initialized with
im trying to initialize a queue rabbit consumer, process those message and send it to a websocket in django. But i got the title error.
Im new at this kind of stuuf. Can someone explain me how can i ...
0
votes
0
answers
9
views
Django channels websocket non working properly
Iìm triing to create a simple chat app usign django channels
i create a consumer on connect method i register all user to a personal group and when i sent a message the recieve method should sent it ...
0
votes
0
answers
41
views
WebSocket Unit Test Not Working in Django with TransactionTestCase
I'm building a simple app where users can join tables to play chess, connecting via WebSocket. Everything works as intended in the development environment: users can log in, join rooms, sit at tables, ...
0
votes
1
answer
32
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
36
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
0
answers
20
views
Sending a notification to single user using web socket in django
In my drf project, I have added the functionality where notifications are being broadcasted to all web socket users. What I want is to send notification to single user. I hope I will get a solution to ...
0
votes
1
answer
107
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 ...
-1
votes
1
answer
90
views
AssertionError: Expected a `Response`, `HttpResponse` or `StreamingHttpResponse` to be returned from the view, but received a `<class 'coroutine'>`
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
0
answers
51
views
django took too long to shut down and was killed
I am using Django Channel for a real-time sending and saving data but when I refresh the page the error came up. I don't know why but, on first load the system is okay but if I reload the page the log ...
0
votes
0
answers
30
views
How to Handle and Send Various File Types (Images, Videos, Audios, PDFs, Documents) in a Django Chat App Using WebSockets and Django REST Framework
I'm working on a chat application where I need to handle and store various types of files such as images, videos, audios, PDFs, and documents using Django and Django REST framework. I have a WebSocket ...
0
votes
0
answers
23
views
Django 404 when connecting to websocket router wh
I'm trying to write my first Django project using websockets. I use django channels. And everything worked fine until the time to integrate react, nginx and django came.
Now I get:
Could not connect ...
0
votes
0
answers
19
views
React front end triggering WebSocket.onmessage twice
I'm new to React and am currently trying to create a real time chat app. I'm nearly finished. the last feature needed is that the React component pasted below needs to receive messages from the Django ...
1
vote
1
answer
97
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
0
answers
36
views
Issue sending messages to a channel group in Django
I sat up a system with a user, member and team models. What i am trying to achieve with sockets, is for one of the team members to notify everyone on the team about an achievement.
Clientside:
Svelte ...
0
votes
0
answers
420
views
Django Channels Config - Django / Docker / Gunicorn / Daphne / Nginx
I have deployed an app, pypilot.app using django / nginx / docker / daphne / gunicorn on a digital ocean droplet. Daphne is for Django Channels which works no problem in development to display ...
0
votes
1
answer
111
views
AttributeError: 'set' object has no attribute 'decode'
I started learning Django for a school project and I'm doing a chat project using websocket server, but when reloading the app I get this error even tho I'm not calling decode() anywhere. I'm using ...
0
votes
1
answer
66
views
django channels took to long to shut down and was killed error in backend
I used django channels in this project and created a consumer in the following code:
class WSConsumer(WebsocketConsumer):
def connect(self):
self.room_name = self.scope["url_route"][&...
1
vote
1
answer
52
views
Websocket jwt authentification keeps handshaking and disconnecting
I have this custom jwt auth-middleware in django:
class JWTAuthMiddleware:
def __init__(self, inner):
self.inner = inner
async def __call__(self, scope, receive, send):
print(": ...
0
votes
0
answers
23
views
Django channels async websocket group_send not working
I've created an async web socket with the below code:
class AgentSessionAsyncConsumer(AsyncJsonWebsocketConsumer):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
...
0
votes
0
answers
39
views
Audio bytes chunks getting corrupted during streaming using Django and Websockets
I am trying to implement an audio streaming transcription service using django and websockets. The implementation works but the chunks get corrupted after some time like after tenth or eleventh chunk ...
0
votes
0
answers
24
views
Django channels web socket not working with nginx and gunicorn in the cloud server
This is my project configuration for Django channels, gunicorn and nginx.
In local machine the django websocket works great. but after deploying to the cloud server it shows this console error:
Mar 27 ...
1
vote
0
answers
11
views
Websockets stopped working after adding nginx and gunicorn
I am making a django-react app, and I use django channels for my websockets in order to create live chat. After adding gunicorn and nginx however, my websockets are no longer able to connect from my ...
0
votes
1
answer
218
views
error "Failed to execute send on Websocket: Still in CONNECTING state" in Django Channels Production environment using SSL
I'm currently deploying an application using Django Channels in Production environment.
The target application is based on the sample app from the official django channel documentation.
https://...
0
votes
0
answers
38
views
Will I need a consumers.py, asgi,py and routing.py using Tradier's websocket API?
So I'm trying to stream market data via the tradier API with websockets. Here are 2 links to the docs:
https://documentation.tradier.com/brokerage-api/streaming/websocket-streaming
https://...
0
votes
0
answers
23
views
How can one enable a mix of authenticated and unauthenticated websockets using Django Channels?
I'm running a Django application with DRF and Channels and I've configured a number of websockets, one of which I need to be open/insecure. However, all I can figure out is how to enable/disable ...
1
vote
1
answer
277
views
django.core.exceptions.SynchronousOnlyOperation You cannot call this from an async context - use a thread or sync_to_async
I am using Django channels to implemented web sockets.
I want to get database queries using ORM inside consumers.py.
This is my code:
import json
from channels.generic.websocket import ...
0
votes
0
answers
31
views
Users may not be connecting to the same websocket - django channels
I’m developing a chat feature using django channels. when a message is sent, It gets created on the server side and I think it’s being broadcasted. in my consumer I'm adding both the sender and ...
0
votes
0
answers
64
views
Django Channels Custom Middleware Not Being Called
With Django 4 and Channels 4
I have a middleware as follows
from channels.middleware import BaseMiddleware
class TokenAuthMiddleware(BaseMiddleware):
async def __call__(self, scope, receive, send)...
1
vote
1
answer
124
views
Django Rest Framework + Django Channels -> [Errno 111] Connect call failed ('127.0.0.1', 6379)
I am programming a project with Django (4.2.6), Django Rest Framework (3.14.0), Channels (4.0.0) and Channels-Redis(4.2.0), which acts as a backend for a mobile application. So far, I haven't had any ...
0
votes
1
answer
68
views
Django channels - Not Found: /ws/stock/track/
I'm following this video, but I don't get the same console output as in the video.
My console output:
[20/Feb/2024 19:09:12] "GET /stocktracker/?stockpicker=AAPL&stockpicker=AMGN HTTP/1.1&...
1
vote
1
answer
71
views
Error in connecting websockets when I push the code to server
I have implemented a Django Channel for real time messages between Group users.
It is working fine on the local system but when I push this to the server, I am getting the error:
WebSocket connection ...
0
votes
0
answers
78
views
group_send() in Django channels
When ever a channel is created I'm adding it in a group. The issue is server sends the message to the latest channel in the group only rather than broadcasting it to the whole group. If I've two ...
0
votes
0
answers
56
views
nginx not upgraded to websocket
i have a Kubernetes cluster in which nginx:1.21.6 is running as a proxy.
Nginx should upgrade the connection to websocket at path /ws/ and forward it to the service http://dev-websocket:8000.
Since ...
0
votes
0
answers
34
views
Django Channels - Sending message to multiple channels
I created a room dict which which stores channels of consumers which belong to a specific group, now when any consumers sends a message i want all the channels to get that message ... but I only know ...
0
votes
0
answers
28
views
Django Channels - Group
If in a group there are two channels, after group_send the event chat.message is handled by chat_message.. and its happening for both the channels because I'm printing the channel names and getting ...
1
vote
1
answer
176
views
Websocket with Django Channels and IIS - No route found for path
I'm trying to deploy my Django application to my IIS server, but my websocket doesn't work when accessing via IIS, only locally. What did I miss?
When I access via IIS:
new WebSocket('ws://server:8000/...
0
votes
0
answers
63
views
Module not found error with Django Channels
I'm completely new to using channels, but have tried two separate installations, and setups to just get a basic version of channels running and am encountering a small issue. I'm assuming I'm probably ...
0
votes
0
answers
27
views
All messages sent at once at the end of all iterations django layers Django-channels
I want to send messages to client side by websocket one by one. Instead they are sent at the end of all iterations at once. I use AsyncWebsocketConsumer, so it should be fine. Another important things ...
0
votes
0
answers
84
views
Django, Redis and channels: Using websockets to pass message to browser page via GET request for notifications
I am trying to set up some async notifications in my django app using redis and channels, and new to websockets!
I'm confused why my consumer methods are being called in a specific order (below). My ...
0
votes
0
answers
99
views
How to send and recieve client webcam MediaStream stream data to django channels for image processing and displaying on client side
I am trying to create a face-detection software using django and opencv, for which I need live stream from client's webcam.
After a lot of search I used bits and pieces and reached this code.
main....
0
votes
0
answers
38
views
Web Socket don't make connection with Wss /https Django
This is my asgi.py.
import os, django
from django.core.asgi import get_asgi_application
from channels.routing import get_default_application
django_asgi_app = get_asgi_application()
# from django....
0
votes
0
answers
64
views
Django Channels Web Socket Connection Keeps Closing
I created the following consumers in my django application to handle real time notifications:
class NotificationConsumer(AsyncWebsocketConsumer):
async def connect(self):
self.room_name = ...
0
votes
1
answer
45
views
How can I get a batch of frames from consumers.py?
I am working on a computer vision project involving object detection and real-time frame streaming using OpenCV and Django. To accomplish this, I am utilizing Django channels. However, I have ...
1
vote
0
answers
245
views
cannot call recv while another coroutine is already waiting for the next message
RuntimeError: cannot call recv while another coroutine is already waiting for the next message
hello
I wrote a counsumer that acts as a middleware that connects to the server socket, for example X, ...
0
votes
0
answers
108
views
django channels error: websocket connection failed
I have a django project what needs websocket connection to send message via django channels.
i coded my project and it's good in my system localhost but when i deploy the project in cPanel it returns ...
0
votes
0
answers
39
views
Django channels unable to connect(find) websocket after dockerize the project
Before trying to containerize the application with docker, it worked well with:
python manage.py runserver
with the following settings.py setction for the redis layer:
CHANNEL_LAYERS = {
"...