ØMQ and Grasshopper

This post from the jeelabs blog clued me in on some very interesting protocols for exchanging data between applications.  One such protocol is ØMQ (a.k.a ZeroMQ,0MQ, or ZMQ).  The ‘MQ’ in ØMQ stands for Message Queuing.  Message Queuing utilizes a message broker to act as a sort of programming language ‘bablefish’ which allows data types from one language to be properly interpreted in another language.  ØMQ takes this a step further by effectively removing the need for the message broker.  Perhaps this is what allows it to work very quickly.

This potential is interesting in the context of Grasshopper3d and the gHowl add-on as it could enhance the communication protocols currently implemented with UDP.  I cooked up a test to test the potential of this within grasshopper.

ØMQ has bindings for many programming languages.  As a test I grabbed the c# bindings and hooked these into a c# component in Grasshopper.  To fast forward this, I used a precompiled library posted on bitbucket.  What is nice about the example that Rick posted also has simple client / server programs which talk to each other.  To start with, I coded a ØMQ client (adapted from Client.exe) in grasshopper to talk to the Server.exe program.

Adapting the Server.exe code to work in GH also works well.

There is still a lot to learn in order to fully take advantage of ØMQ.  I am particularly interested in testing different application / device topologies and how it can be useful for embedded devices.  This last point is important.  ØMQ is maybe not the best choice for embedded devices which typically have limited memory space.  A comment from the reference blog post led me to MQTT and the Arduino library posted by Knoll Leary on github.

I plan to further look into these protocols in order to extend gHowl with a language agnostic communication framework.



Leave a Reply