Mercurial > code > home > repos > light9
diff bin/dmxserver @ 1220:d5e99fee786d
twisted uses zmq (not xmlrpc) to send levels to dmxserver
Ignore-this: 78d627e1ff8c8e83b50ae099d373b8c1
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Mon, 08 Jun 2015 06:53:12 +0000 |
parents | ba47676dde49 |
children | a5a44077c54c |
line wrap: on
line diff
--- a/bin/dmxserver Mon Jun 08 02:26:14 2015 +0000 +++ b/bin/dmxserver Mon Jun 08 06:53:12 2015 +0000 @@ -34,6 +34,17 @@ from light9.updatefreq import Updatefreq from light9 import networking +from txzmq import ZmqEndpoint, ZmqFactory, ZmqPullConnection, ZmqRequestTimeoutError +import json + +def startZmq(port, outputlevels): + zf = ZmqFactory() + e = ZmqEndpoint('bind', 'tcp://*:%s' % port) + s = ZmqPullConnection(zf, e) + def onPull(message): + msg = json.loads(message[0]) + outputlevels(msg['clientid'], msg['levellist']) + s.onPull = onPull class ReceiverApplication(object): """ @@ -248,6 +259,8 @@ xmlrpcServe = XMLRPCServe(options) reactor.listenTCP(port,server.Site(xmlrpcServe)) +startZmq(networking.dmxServerZmq.port, xmlrpcServe.xmlrpc_outputlevels) + oscApp = ReceiverApplication(9051, xmlrpcServe) reactor.run()