Exemplo n.º 1
0
    def __init__(self, opts):
        self.opts = opts

        self.subscriber = ZmqSubscriber(**ZmqSubscriber.getOptionValues(self.opts))
        self.application = tornado.web.Application([
            (r"^/?$", MainHandler),
            (r"^/zmq/$", ClientSocket),
            ])
Exemplo n.º 2
0
    def __init__(self, opts):
        self.opts = opts

        self.subscriber = ZmqSubscriber(
            **ZmqSubscriber.getOptionValues(self.opts))
        self.application = tornado.web.Application([
            (r"^/?$", MainHandler),
            (r"^/zmq/$", ClientSocket),
        ])
Exemplo n.º 3
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog')
    parser.add_option('-p', '--port',
                      type='int', default=8001,
                      help='TCP port where websocket server should listen [%default]')
    ZmqSubscriber.addOptions(parser, 'zmqProxy')
    opts, args = parser.parse_args()
    if args:
        parser.error('expected no args')

    global proxyG
    proxyG = ZmqProxy(opts)
    proxyG.start()

    zmqLoop()
Exemplo n.º 4
0
class ZmqProxy(object):
    def __init__(self, opts):
        self.opts = opts

        self.subscriber = ZmqSubscriber(**ZmqSubscriber.getOptionValues(self.opts))
        self.application = tornado.web.Application([
            (r"^/?$", MainHandler),
            (r"^/zmq/$", ClientSocket),
            ])

    def start(self):
        # initialize zmq
        self.subscriber.start()

        # start serving web clients
        print 'binding to port %d' % self.opts.port
        self.application.listen(self.opts.port)
Exemplo n.º 5
0
class ZmqProxy(object):
    def __init__(self, opts):
        self.opts = opts

        self.subscriber = ZmqSubscriber(
            **ZmqSubscriber.getOptionValues(self.opts))
        self.application = tornado.web.Application([
            (r"^/?$", MainHandler),
            (r"^/zmq/$", ClientSocket),
        ])

    def start(self):
        # initialize zmq
        self.subscriber.start()

        # start serving web clients
        print 'binding to port %d' % self.opts.port
        self.application.listen(self.opts.port)
Exemplo n.º 6
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog')
    parser.add_option(
        '-p',
        '--port',
        type='int',
        default=8001,
        help='TCP port where websocket server should listen [%default]')
    ZmqSubscriber.addOptions(parser, 'zmqProxy')
    opts, args = parser.parse_args()
    if args:
        parser.error('expected no args')

    global proxyG
    proxyG = ZmqProxy(opts)
    proxyG.start()

    zmqLoop()
Exemplo n.º 7
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog')
    ZmqSubscriber.addOptions(parser, 'testSubscriber')
    opts, args = parser.parse_args()
    if args:
        parser.error('expected no args')
    logging.basicConfig(level=logging.DEBUG)

    # set up networking
    s = ZmqSubscriber(**ZmqSubscriber.getOptionValues(opts))
    s.start()

    # subscribe to the message we want
    s.subscribeRaw('geocamUtil.greeting:', handleGreeting)

    zmqLoop()
Exemplo n.º 8
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog')
    ZmqSubscriber.addOptions(parser, 'testSubscriber')
    opts, args = parser.parse_args()
    if args:
        parser.error('expected no args')
    logging.basicConfig(level=logging.DEBUG)

    # set up networking
    s = ZmqSubscriber(**ZmqSubscriber.getOptionValues(opts))
    s.start()

    # subscribe to the message we want
    s.subscribe('geocamUtil.greeting:', handleGreeting)

    zmqLoop()
Exemplo n.º 9
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog <prefix>')
    parser.add_option('-p', '--pretty',
                      action='store_true', default=False,
                      help='Pretty-print JSON objects')
    ZmqSubscriber.addOptions(parser, 'zmqGrep')
    opts, args = parser.parse_args()
    if len(args) != 1:
        parser.error('expected exactly 1 arg')
    logging.basicConfig(level=logging.DEBUG)

    # set up networking
    s = ZmqSubscriber(**ZmqSubscriber.getOptionValues(opts))
    s.start()

    # subscribe to the message we want
    topic = args[0]
    if opts.pretty:
        s.subscribeJson(topic, handleMessagePretty)
    else:
        s.subscribeRaw(topic, handleMessageSimple)

    zmqLoop()
Exemplo n.º 10
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog <prefix>')
    parser.add_option('-p',
                      '--pretty',
                      action='store_true',
                      default=False,
                      help='Pretty-print JSON objects')
    ZmqSubscriber.addOptions(parser, 'zmqGrep')
    opts, args = parser.parse_args()
    if len(args) != 1:
        parser.error('expected exactly 1 arg')
    logging.basicConfig(level=logging.DEBUG)

    # set up networking
    s = ZmqSubscriber(**ZmqSubscriber.getOptionValues(opts))
    s.start()

    # subscribe to the message we want
    topic = args[0]
    if opts.pretty:
        s.subscribeJson(topic, handleMessagePretty)
    else:
        s.subscribeRaw(topic, handleMessageSimple)

    zmqLoop()