This is a simple ZeroMQ adapter for Faraday. It speaks a simple HTTP-like JSON protocol over a ZeroMQ REQ socket.
Each request sends a header message, followed by a body message. The Header should be an object like this, serialized as JSON:
[method, path, headers]
After JSON serialization, it might look something like:
The body is not serialized in any way. Therefore, you can send any text or binary content.
The Response also comes in two messages. The header message is an object like this, serialized as JSON:
After serialization, it looks like:
Like the request body, the response body has no serialization either.
# if you want to use the rbzmq library, you may have to wrap it in a # shim that responds to #send_string and #recv_string. require 'ffi-rzmq' context = ZMQ::Context.new socket = context.socket ZMQ::REQ socket.connect 'tcp://127.0.0.1:5555' conn = Faraday.new do |builder| builder.adapter :zeromq, socket end res = conn.get '/a'
See the examples directory for basic servers written in ruby, python, and node.js.