To Install

npm will yell at you if you don't have node 0.3.0, as that is required.

API

The API contains elements of the ØMQ API. You should refer to it
for in depth detail of the expected behaviors of the system. These methods will
never return error codes, but may throw an exception if any of the errors
described in the ØMQ documentation occur.

First, include the module:

zmq = require('zmq');

After that, you can create sockets with:

socket = zmq.createSocket('req');

Using ØMQ sockets

A socket is where the action happens. You can send and receive things and it is
oh such fun.

Constructor - function(type)

type - A string describing the type of socket. You can read about the
different socket types here. The name you use here matches the
names of the ZMQ_* constants, sans the ZMQ_ prefix.

Methods

connect(address) - Connect to another socket. address should be a string
as described in the ØMQ API docs. This method is not
asynchronous because it is non-blocking. ØMQ will use the provided address
when it's necessary and will not block here.

bind(address, callback) - Bind to a socket to wait for incoming data.
address should be a string as described in the ØMQ API docs.
callback will be called when binding is complete and takes one argument,
which may be an Error, or simply undefined if everything's peachy.

send(message, ...) - message is a string to send across the wire. The
message is not sent immediately, but there is no callback indicating when
it has been transmitted. Have your server ack or something if you care that
much.

The message must be a Buffer object or a string. It is assumed that
strings should be transmitted as UTF-8. If you provide more than one
argument to send, then a multipart ØMQ message will be sent.

close() - Closes the socket

Socket Options

To set a socket option on a socket, use socket[property]. For example,

socket['identity'] = "mainLoop";

The following properties are available (the ZMQ_XXX constant describes the name in the ZeroMQ documentation available at ØMQ setsockopt API):