whole_func_string: 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;
  }
func_code_string: 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;
  }
func_documentation_string: A helper to create a ZMQ socket (of the specified type) and an optional message handler to handle incoming messages.