title: nodejs server-side simulation
body: <p>I'm trying to create a nodejs server where I'm running a simple x/y world, which the clients can push/pull data from. If I would do a world-simulation like this on the client side only with box2d or something, I would use the setTimeout function to which would call a step-function. This does not work when I try it in nodejs. The server crashes with the error "RangeError: Maximum call stack size exceeded". </p>
  
  <p>This is my server.js. The world parameter is an instance of a world object that the router can manipulate. </p>
  
  <pre><code>var http = require("http");
  
  function start(world, router, handlers) {
  
  function onRequest(request, response) {
      router(world, handlers, request, response);
  
  }
  
  http.createServer(onRequest).listen(8888);
  console.log("ServerStarted. Listens to 8888.");
  
  step_world(world,0);
  }
  
  function step_world(world,step) {
  world.update();
  step++;
  console.log("updating world: " + step);
  step_world(world,step);
  //setTimeout(step_world(world,step),1000/30);
  }
  
  exports.start = start;
  </code></pre>
  
  <p>So: how do I run a simulation with nodejs? </p>