title: Websockets behind nginx triggered by zeromq?
body: <p>I'm trying to design a system that will process large amounts of data and send updates to the client about its progress. I'd like to use nginx (which, thankfully, just started supporting websockets) and uwsgi for the web server, and I'm passing messages through the system with zeromq. Ideally the solution could be written in Python, but I'm also open to a Nodejs or even a Go solution.</p>
  
  <p>Here is the flow that I'd like to achieve:</p>
  
  <ol>
  <li>Client visits a website and requests that a large amount of data be processed.</li>
  <li>The server farms out the processing to another process/server [the worker] via zeromq, and replies to the client request explaining that processing has begun, including information about how to set up a websocket with the server.</li>
  <li>The client sets up the websocket connection and waits for updates.</li>
  <li>When the processing is done, the worker sends a "processing done!" message to the websocket process via zeromq, and the websocket process pushes the message down to the client.</li>
  </ol>
  
  <p>Is what I describe possible? I guess I was thinking that I could run uwsgi in emperor mode so that it can handle one process (port) for the webserver and another for the websocket process. I'm just not sure if I can find a way to both receive zeromq message and manage websocket connections all from the same process. Maybe I have to initiate the final websocket push from the worker?</p>
  
  <p>Any help/correct-direction-pointing/potential-solutions would be much appreciated. Any sample or snippet of an nginx config file with websockets properly routed would be appreciated as well.</p>
  
  <p>Thanks!</p>