Project

omq-ffi

0.0
No release in over 3 years
libzmq FFI backend for OMQ — use libzmq under the same OMQ socket API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 0
~> 0.23
 Project Readme

OMQ::FFI -- libzmq Backend for OMQ

CI Gem Version License: ISC Ruby

Use libzmq under the same OMQ socket API. Requires libzmq 4.x installed on the system.

require "omq"
require "omq/ffi"

push = OMQ::PUSH.new(backend: :ffi)
push.connect("tcp://127.0.0.1:5555")
push.send("hello from libzmq")

The FFI backend replaces the entire pure-Ruby ZMTP stack with libzmq. The socket API, options, and Async integration remain identical. A dedicated I/O thread per socket handles all libzmq operations (libzmq sockets are not thread-safe).

Interop

FFI and native (pure Ruby) backends are wire-compatible. You can mix them freely:

# native REP server
rep = OMQ::REP.bind("tcp://127.0.0.1:5555")

# FFI REQ client
req = OMQ::REQ.new(backend: :ffi)
req.connect("tcp://127.0.0.1:5555")

Requirements

  • Ruby >= 3.3
  • libzmq 4.x (libzmq5 / libzmq3-dev on Debian/Ubuntu)
  • omq >= 0.10