# -*- coding: utf-8 -*- from django.core.serializers.json import json, DjangoJSONEncoder from channels.generic.websockets import JsonWebsocketConsumer class DjangoJsonWebsocketConsumer(JsonWebsocketConsumer): """Custom Json Websocket Consumer. Encode to JSON with DjangoJSONEncoder. """ @classmethod def encode_json(cls, content): return json.dumps(content, cls=DjangoJSONEncoder) class KPsul(DjangoJsonWebsocketConsumer): groups = ['kfet.kpsul']