Thursday, November 30, 2017

why is `WebsocketMultiplexer.group_send` a class method?

why is `WebsocketMultiplexer.group_send` a class method?      Currently it's the following:        @classmethod      def group_send(cls, name, stream, payload, close=False):          message = cls.encode(stream, payload)          if close:              message["close"] = True          Group(name).send(message)      what is to stop it being the following?        def group_send(self, name, payload, close=False):          message = cls.encode(self.stream, payload)          if close:              message["close"] = True          Group(name).send(message)      `group_send` being a class method makes call more verbose than it appears neccisary      multiplexer.group_send(name='my-group', stream=multiplexer.stream, payload={})    https://github.com/django/channels/blob/8e2bbebe6d62850f0c5072b1541d96d9b932c472/channels/generic/websockets.py#L215

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4d3f592d-c97a-4ecc-bc40-aa756ff76be2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment