backend/websocket/consumers.py

24 lines
457 B
Python

from channels.generic.websocket import JsonWebsocketConsumer
class NotificationsConsumer(JsonWebsocketConsumer):
groups = ['notifications']
def connect(self):
self.accept()
def disconnect(self, close_code):
pass
def receive_json(self, content):
pass
def task_finished(self, event):
self.send_json({
'type': event['description'],
'content': event['content']
})