Exemplo n.º 1
0
class EchoWebSocket(tornado.websocket.WebSocketHandler):
    '''stare_at后为订阅的主题'''
    def check_origin(self, origin):
        return True

    def open(self, object):
        self.ml = Msglet(self.tell)
        self.ml.subscribe(object)

    def on_message(self, message):
        self.write_message(message)

    def tell(self, items):
        self.write_message(items[1])
        app_log.info(items)

    def on_connection_close(self):
        self.ml.close()
Exemplo n.º 2
0
 def open(self, object):
     self.ml = Msglet(self.tell)
     self.ml.subscribe(object)