Mozilla XPCOM Binding for 0MQ.
C C++
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
CMakeLists.txt
README.md
ZMQModules.cpp
moz0mq.xpt
nsIZMQ.h
nsIZMQ.idl
nsZMQImpl.cpp
nsZMQImpl.h
test_pub.c
test_rep.c
test_req.c
test_sub.c

README.md

Experimental Mozilla XPCOM bindings for 0MQ

This is Mozilla XPCOM bindings for 0MQ (2.2.x recommended).

Build for Linux

Debian or Ubuntu Required Packages cmake / xulrunner-dev / libzmq

  1. cmake .
  2. make

Build for MacOSX or specified XULRunner SDK

brew install cmake pkg-config .

  1. build zeromq 2.2.x.
  2. download and untar xulrunner-sdk.
  3. cmake -D XULRUNNER-SDK=/usr/local/xulrunner-sdk .
  4. make

Install

Copy built .so and .xpt to your xulrunner application's components directory.

Examples

// create new zmq context
var zmqContext = Components.classes["@racklin.gmail.com/zmq;1"].createInstance(Components.interfaces.nsIZMQ);

// dump zmq version
// alert or console.log
alert(zmqContext.version);

// init zmq context with io threads number
zmqContext.init(1);

// create socket with type
zmqContext.socket(zmqContext.ZMQ_REQ);

// connect to endpoint
zmqContext.connect("tcp://127.0.0.1:5555");

// send
zmqContext.send("hello world.");

// recv
var message = zmqContext.recv();

// close socket
zmqContext.close();

// terminate context
zmqContext.term();

License

Licensed under the LGPL License.