Tests pour le BDS #816
1 changed files with 3 additions and 24 deletions
|
@ -71,6 +71,9 @@ class DjangoJsonWebsocketConsumer(AsyncJsonWebsocketConsumer):
|
|||
|
||||
@classmethod
|
||||
async def encode_json(cls, content):
|
||||
# Remove the type value, only used by Channels to choose the group to send to
|
||||
content.pop("type")
|
||||
|
||||
return json.dumps(content, cls=DjangoJSONEncoder)
|
||||
|
||||
|
||||
|
@ -96,27 +99,3 @@ class PermConsumerMixin:
|
|||
await super().connect()
|
||||
else:
|
||||
await self.close()
|
||||
|
||||
# async def raw_connect(self, message, **kwargs):
|
||||
# # Same as original raw_connect method of JsonWebsocketConsumer
|
||||
# # We add user to connection_groups call.
|
||||
# groups = self.connection_groups(user=message.user, **kwargs)
|
||||
# for group in groups:
|
||||
# await self.channel_layer.group_add(group, message.reply_channel)
|
||||
# # Group(group, channel_layer=message.channel_layer).add(message.reply_channel)
|
||||
# self.connect(message, **kwargs)
|
||||
#
|
||||
# async def raw_disconnect(self, message, **kwargs):
|
||||
# # Same as original raw_connect method of JsonWebsocketConsumer
|
||||
# # We add user to connection_groups call.
|
||||
# groups = self.connection_groups(user=message.user, **kwargs)
|
||||
# for group in groups:
|
||||
# await self.channel_layer.group_discard(group, message.reply_channel)
|
||||
# # Group(group, channel_layer=message.channel_layer).discard(
|
||||
# # message.reply_channel
|
||||
# # )
|
||||
# self.disconnect(message, **kwargs)
|
||||
#
|
||||
# def connection_groups(self, user, **kwargs):
|
||||
# """`message.user` is available as `user` arg. Original behavior."""
|
||||
# return super().connection_groups(user=user, **kwargs)
|
||||
|
|
Loading…
Reference in a new issue