https://github.com/racklin/moz-zeromq
Mozilla XPCOM Binding for 0MQ.
https://github.com/racklin/moz-zeromq
Last synced: about 1 year ago
JSON representation
Mozilla XPCOM Binding for 0MQ.
- Host: GitHub
- URL: https://github.com/racklin/moz-zeromq
- Owner: racklin
- Created: 2013-04-02T08:24:59.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2013-04-03T04:45:05.000Z (about 13 years ago)
- Last Synced: 2024-04-09T15:28:34.125Z (about 2 years ago)
- Language: C
- Size: 133 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Experimental Mozilla XPCOM bindings for 0MQ
----------------------------------------
This is Mozilla XPCOM bindings for [0MQ](http://www.zeromq.org) (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](http://www.gnu.org/licenses/lgpl.html).