1.. _draft:
2
3Working with libzmq DRAFT sockets
4=================================
5
6libzmq-4.2 has introduced the concept of unstable DRAFT APIs.
7As of libzmq-4.2, this includes the CLIENT-SERVER and RADIO-DISH patterns.
8
9Because these APIs are explicitly unstable,
10pyzmq does not support them by default,
11and pyzmq binaries (wheels) will not be built with DRAFT API support.
12However, pyzmq-17 can be built with draft socket support,
13as long as you compile pyzmq yourself with a special flag.
14
15To install libzmq with draft support:
16
17.. sourcecode:: bash
18
19    ZMQ_VERSION=4.3.4
20    PREFIX=/usr/local
21
22    wget https://github.com/zeromq/libzmq/releases/download/v${ZMQ_VERSION}/zeromq-${ZMQ_VERSION}.tar.gz -O libzmq.tar.gz
23    tar -xzf libzmq.tar.gz
24    cd zeromq-${ZMQ_VERSION}
25    ./configure --prefix=${PREFIX} --enable-drafts
26    make -j && make install
27
28
29And to install pyzmq with draft support:
30
31.. sourcecode:: bash
32
33    export ZMQ_PREFIX=${PREFIX}
34    export ZMQ_DRAFT_API=1
35    pip install -v --no-binary pyzmq --pre pyzmq
36
37By specifying ``--no-binary pyzmq``, pip knows to not install wheels, and will compile pyzmq from source.
38
39The ``ZMQ_PREFIX=$PREFIX`` part is only necessary if libzmq is installed somewhere not on the default search path.
40If libzmq is installed in :file:`/usr/local` or similar,
41only the ``ZMQ_ENABLE_DRAFTS`` option is required.
42
43There are examples of the CLIENT-SERVER and RADIO-DISH patterns in the :file:`examples/draft`
44directory of the pyzmq repository.
45