summaryrefslogtreecommitdiffstats
path: root/gitautodeploy/wsserver.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitautodeploy/wsserver.py')
-rw-r--r--gitautodeploy/wsserver.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/gitautodeploy/wsserver.py b/gitautodeploy/wsserver.py
new file mode 100644
index 0000000..3198c18
--- /dev/null
+++ b/gitautodeploy/wsserver.py
@@ -0,0 +1,21 @@
+from SimpleWebSocketServer import WebSocket
+
+clients = []
+class WebSocketClientHandler(WebSocket):
+
+ def handleMessage(self):
+ for client in clients:
+ if client != self:
+ client.sendMessage(self.address[0] + u' - ' + self.data)
+
+ def handleConnected(self):
+ print (self.address, 'connected')
+ for client in clients:
+ client.sendMessage(self.address[0] + u' - connected')
+ clients.append(self)
+
+ def handleClose(self):
+ clients.remove(self)
+ print (self.address, 'closed')
+ for client in clients:
+ client.sendMessage(self.address[0] + u' - disconnected')