aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Gareth Coles <[email protected]>2018-05-29 17:59:20 +0100
committerGravatar Gareth Coles <[email protected]>2018-05-29 17:59:20 +0100
commitd982088c7be97cfa843240b0d10b361e94152cf2 (patch)
treec9b54ec70e22f89b92534879ea85eedf17de0fb8
parentWS objects now keep track of their connections (diff)
[WS] "send all" methods should be classmethods
-rw-r--r--pysite/websockets.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/pysite/websockets.py b/pysite/websockets.py
index ff8f0a12..213daace 100644
--- a/pysite/websockets.py
+++ b/pysite/websockets.py
@@ -71,12 +71,14 @@ class WS:
def send_json(self, data):
return self.send(json.dumps(data))
- def send_all(self, message, binary=None):
- for connection in self._connections:
+ @classmethod
+ def send_all(cls, message, binary=None):
+ for connection in cls._connections:
connection.send(message, binary=binary)
- def send_all_json(self, data):
- for connection in self._connections:
+ @classmethod
+ def send_all_json(cls, data):
+ for connection in cls._connections:
connection.send_json(data)
@classmethod