Skip to content
Python RPC library using zmq for transport, and BSON for buffers
Pull request Compare This branch is even with geoffwatts:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


A Python library that exports a class for RPC via zmq, using BSON for data interchange.


zmqrpc is registered at pypi.

Install using pip or easy_install:

$> pip install zmqrpc


Contributing and Enhancements

Go for it, fork away and fix it up. There's a lot of performance tweaks that can be made, this is very much 0.1

Most notably, I think the bson encoding should happen inside pyzmq.


A basic server:

This server will listen on TCP port 5000, and start 2 worker threads for the class Test

    class Test(object):

        def __init__(self):
            self.count = 0

        def test(self):
            self.count += 1
            return self.count        

    from zmqrpc.server import ZMQRPCServer, LISTEN, CONNECT

    server = ZMQRPCServer(Test)

A basic client:

This client connects to our server, then runs the test() method 5000 times. It then prints the last output of rpc.test(), and pprint's the server status.

    from zmqrpc.client import ZMQRPC 
    import sys
    import pprint

    rpc = ZMQRPC("tcp://",timeout=5)
    for i in range(5000):
        x = rpc.test()

    print x
    servers = rpc.__serverstatus__()

Usage Notes

This library is still very early. The API is likely to change.

Something went wrong with that request. Please try again.