johndodo
johndodo

Reputation: 18291

processing HTTPS requests and ZeroMQ messages in parallel inside Twisted

I am trying to do two things in parallel:

I know how to make each of these two things separately, but how can I do them in parallel? To be specific, how can I receive messages from ZeroMQ inside the Twisted framework, when I am already listening to TCP sockets?

Upvotes: 1

Views: 368

Answers (1)

Glyph
Glyph

Reputation: 31910

You can get support for ZMQ here, in txZMQ.

It sounds like you already know how to deal with the HTTP request.

To do these things in parallel, just create your ZmqSubConnection and your twisted.web.server.Site, with references to each other as necessary for your application. No special set-up is required.

Just make sure you only create and run one reactor. Other people with similar questions sometimes don't understand that reactor.run() means "run the event loop for the whole process", and not "run this one thing I set up".

Upvotes: 1

Related Questions