Estoy tratando de llamar a una x funcion de un consumidor channels, desde una vista de django, pero la llamada nunca llega a la funcion y no entiendo por que.
views.py
def Llamar_a_Prueba():
channel_layer = get_channel_layer()
async_to_sync(channel_layer.group_send)('hola', {"type": "probar","text": "probar"})
cosumers.py
class RevisionConsumer(AsyncWebsocketConsumer):
async def connect(self):
await self.channel_layer.group_add('hola',self.channel_name)
await self.accept()
await self.actualizar()
async def disconnect(self,close_code):
print("Se desconecto el socket")
await self.channel_layer.group_discard('hola',self.channel_name)
async def receive(self,text_data):
data = json.loads(text_data)
async def actualizar(self):
#print("entrooooooooooooooo")
await self.send(text_data=json.dumps({'Cantidad_de_Notificaciones': await self.actualizar_valor_cant_notificaciones()}))
async def probar(self,event):
print("entroooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo")
settings.py
ASGI_APPLICATION = "ServiHogar2.asgi.application"
CHANNEL_LAYERS = {
'default': {
'BACKEND': 'channels_redis.core.RedisChannelLayer',
'CONFIG': {
"hosts": [('127.0.0.1', 6379)],
},
},
}
Si necesitan algun dato mas del proyecto, pidanlo y se los doy. Gracias de antemano