def open(self): global scoringWebsocketHandler scoringWebsocketHandler = self print 'Scoring connected' self.write_message(json.dumps({'type':'matchList', 'data':{'matchList':database.getMatchList(), 'tableList':database.getTableNames()}})) self.write_message(json.dumps({'type':'currentMatchIndex', 'data':{'currentMatchIndex':match_schedule.currentMatchIndex}})) self.write_message(json.dumps({'type':'scores', 'data':{}}))
def on_message(self, message): print 'received:', message msg = json.loads(message) if msg['type'] == 'score': database.editScore(msg['data']) self.write_message(json.dumps({'type':'matchList', 'data':{'matchList':database.getMatchList(), 'tableList':database.getTableNames()}}))