2022-06-29 11:10:37 +02:00
|
|
|
from asgiref.sync import async_to_sync
|
|
|
|
from channels.layers import get_channel_layer
|
|
|
|
|
2017-06-21 07:08:28 +02:00
|
|
|
from .utils import DjangoJsonWebsocketConsumer, PermConsumerMixin
|
2017-06-12 15:18:42 +02:00
|
|
|
|
|
|
|
|
2017-04-09 16:10:27 +02:00
|
|
|
class KPsul(PermConsumerMixin, DjangoJsonWebsocketConsumer):
|
2018-10-06 12:35:49 +02:00
|
|
|
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)
|