code: function createSocket(type, ip, port, messageHandler) {
    var uri = util.format('tcp://%s:%d', ip, port);
    var socket = zmq.createSocket(type);
  
    socket.bind(uri, function(e) { });
    if (messageHandler) {
      socket.on('message', messageHandler);
    }
  
    return socket;
  }
docs: A helper to create a ZMQ socket (of the specified type) and an optional message handler to handle incoming messages.