home · contact · privacy
f7757766139ca809ea26e858a6fd0cace6da2f36
[plomrogue2-experiments] / websocket_server.py
1 #!/usr/bin/env python3
2 from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket
3
4 game = {'turn': 0}
5
6 class GameServer(WebSocket):
7
8     def handleMessage(self):
9         self.sendMessage('TURN: %s' % game['turn'])
10         game['turn'] += 1
11
12 server = SimpleWebSocketServer('', 8000, GameServer)
13 server.serveforever()