class ZMQ::Proxy
The proxy connects a frontend socket to a backend socket. Conceptually, data flows from frontend to backend. Depending on the socket types, replies may flow in the opposite direction. The direction is conceptual only; the proxy is fully symmetric and there is no technical difference between frontend and backend.
Public Class Methods
new(frontend, backend, capture = nil)
click to toggle source
Accepts a frontend, backend, and optional capture socket. See api.zeromq.org/4-0:zmq-proxy
# File lib/0mq/proxy.rb, line 18 def initialize(frontend, backend, capture = nil) @frontend = frontend.nil? ? nil : frontend.to_ptr @backend = backend.nil? ? nil : backend.to_ptr @capture = capture.nil? ? nil : capture.to_ptr end
proxy(frontend, backend, capture = nil)
click to toggle source
Create a running proxy object.
# File lib/0mq/proxy.rb, line 12 def self.proxy(frontend, backend, capture = nil) new(frontend, backend, capture).tap { |p| p.run } end
Public Instance Methods
run()
click to toggle source
Block the current thread with the event loop of the proxy
# File lib/0mq/proxy.rb, line 25 def run LibZMQ.zmq_proxy @frontend, @backend, @capture end