diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-09-17 12:40:07 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-09-17 12:40:07 -0400 |
commit | 95d3a2ef4001473aa382eafea2ed00a066973c11 (patch) | |
tree | c82ce766bb9334ef94ce9fbb1e96f84aef081f1c /termcast.py | |
parent | 92ba955c9cb5836c21d15537f9cccc91a999bc53 (diff) | |
download | python-termcast-server-95d3a2ef4001473aa382eafea2ed00a066973c11.tar.gz python-termcast-server-95d3a2ef4001473aa382eafea2ed00a066973c11.zip |
report the number of viewers in the selection menu
Diffstat (limited to 'termcast.py')
-rw-r--r-- | termcast.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/termcast.py b/termcast.py index 1a6beb7..3363365 100644 --- a/termcast.py +++ b/termcast.py @@ -94,6 +94,7 @@ class Connection(object): self.client = client self.connection_id = connection_id self.publisher = publisher + self.viewers = 0 def run(self): buf = b'' @@ -144,11 +145,13 @@ class Connection(object): def msg_new_viewer(self, connection_id): if connection_id != self.connection_id: return + self.viewers += 1 self.publisher.notify("new_data", self.connection_id, self.handler.buf, b'') self.client.send(b"msg watcher connected\n") def msg_viewer_disconnect(self, connection_id): self.client.send(b"msg watcher disconnected\n") + self.viewers -= 1 def request_get_streamers(self): return { @@ -158,4 +161,5 @@ class Connection(object): "cols": self.handler.cols, "idle_time": self.handler.idle_time(), "total_time": self.handler.total_time(), + "viewers": self.viewers, } |