gestioCOF/kfet/consumers.py

19 lines
528 B
Python
Raw Normal View History

2022-06-29 11:10:37 +02:00
from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
from .utils import DjangoJsonWebsocketConsumer, PermConsumerMixin
class KPsul(PermConsumerMixin, DjangoJsonWebsocketConsumer):
groups = ["kfet.kpsul"]
perms_connect = ["kfet.is_team"]
2022-06-27 15:34:24 +02:00
async def kpsul(self, event):
await self.send_json(event)
2022-06-29 11:10:37 +02:00
@classmethod
@async_to_sync
async def group_send(cls, group, data):
channel_layer = get_channel_layer()
await channel_layer.group_send(group, data)