Beispiel #1
0
def process_outbound_messages(msg_queue):
    while True:
        if websockets:
            break
        yield tornado.gen.sleep(1)

    while True:
        try:
            item = msg_queue.get_nowait()
            if item == SHUTDOWN:
                exit(0)
            for s in websockets:
                s.write_message(str(item))
        except queue.Empty:
            yield tornado.gen.sleep(0.01)
        finally:
            # msg_queue.task_done()
            pass
    logger.debug("exiting loop")
Beispiel #2
0
 def on_message(self, message):
   logger.debug('received: {0}'.format(message))
Beispiel #3
0
 def on_close(self):
   logger.debug('connection closed...')
   websockets.remove(self)
Beispiel #4
0
 def open(self):
   logger.debug('connection opened...')
   websockets.append(self)