title: return value from zmq socket
body: <p>I am using Socket.IO to have a client webpage fetch data dynamically from my Node.JS server. On the server-side, I am forwarding the request to a Python backend using the zeromq socket library (REQ/REP structure, see the rrclient.js example from zguide).</p>
  
  <p>However, since my server is acting as the socket.io server, I have to wrap my response as follows in order to send it back to the specific client:</p>
  
  <pre><code>socket.on('app_request',function(appRequest){
        //route this request to the backend.
        var results = fetch_data(appRequest);
        //return it to the client
        socket.emit('app_results',results);
    });
  </code></pre>
  
  <p>so the fetch_data function uses a zmq socket (socket.send) to push a request to the server.</p>
  
  <p>But the Node ZMQ socket responds to request using a socket.on('message',function(){}); listener and doesn't actually return anything. </p>
  
  <p><em>How can I use socket.on('message',function(){}); to return a value to the specific function that initiated a socket.send() request?</em></p>
  
  <p>In other words, how can I get a client's socket.io request to have Node.JS fetch relevant data from a python backend using ZMQ, then return it back to the socket.io client? (in a non-blocking fashion of course)</p>