[zeromq-dev] HTTP -> 0MQ XREQ proxy example.

Pieter Hintjens ph at imatix.com
Sat Mar 19 13:00:37 CET 2011


This is neat. It's something lots of people have discussed making but
no-one's actually done.

Presumably this gives us security over HTTPS, and makes 0MQ accessible
to JavaScript clients.

One thing I'm wondering, if we can make a formal specification for
what 0MQ-over-HTTP (and HTTP-over-0MQ) looks like, so that different
implementations interoperate.


On Sat, Mar 19, 2011 at 12:37 PM, Robert G. Jakabosky
<bobby at sharedrealm.com> wrote:
> Hi all,
> I have created a simple HTTP to 0MQ proxy [1] written in 150 lines of Lua
> code.  It uses the async. HTTP server & 0MQ socket handlers from my lua-
> handlers [2] project.
> When a HTTP POST request is received it allocates a unique request id and
> sends the POST data to a XREQ socket with a message envelope so that it can
> route the responses from the XREQ socket back to the correct HTTP client.  It
> would be very easy to add the HTTP request/response headers to the 0MQ
> messages by adding a JSON part to the messages.
> To try it out run the proxy with:
> lua examples/http_zmq_proxy.lua tcp://localhost:1080/ tcp://
> then start a backend XREP server on port 5555:
> lua examples/zmq_xrep_server.lua
> then send a simple POST request:
> curl -d "test 1" "http://localhost:1080/"
> 1. https://github.com/Neopallium/lua-
> handlers/blob/master/examples/http_zmq_proxy.lua
> 2. https://github.com/Neopallium/lua-handlers
> --
> Robert G. Jakabosky
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

More information about the zeromq-dev mailing list