-
-
Notifications
You must be signed in to change notification settings - Fork 617
Closed
Labels
Description
Hi,
I'm trying to implement a simple socket emit with Django 3 and Daphne, but for some reason the event emited isn't never captured by the client. Here is my code
asgi.py
import os
import socketio
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'eleicoes.settings')
sio = socketio.AsyncServer(async_mode='asgi', cors_allowed_origins='*')
application = socketio.ASGIApp(sio, get_asgi_application())
views.py
from eleicoes.asgi import sio
# other code
print('emit vote event', sio)
sio.emit('user', UserSerializer(instance=request.user).data)
# other code
It simples doesn't work. I think I followed the documentation in this matter but I can't find anything with this specific setup (django 3 and daphne)