def start(cls, ui, title, debug=False, port=9999): if debug: logging.basicConfig(level=logging.DEBUG) log.debug() app = cls.tornado_app(ui, title, debug=debug) app.listen(port) IOLoop.instance().start()
def on_close(self): log.debug()
def on_message(self, msg): msg = json.loads(msg) log.debug(msg)
def on_open(self, info): log.debug() self.send_json('ready')
def send_json(self, kind, data=None): log.debug() self.send(json.dumps({'kind': kind, 'data': data or {}}))