simo
simo

Reputation: 24560

Remote simulation with nodejs?

At client side, I will have a physics simulation, user will create the simulation arguments using HTML5 based interactive view.

The simulation arguments will be sent to server side, where child nodejs process will calculate the results and send back to client.

The simulation results are emitted to client each one second.

I know that I will be using HTML5 websockets, Is there a proto type or an example close to what I am trying to do? Or a nodejs module? I am not streaming a file, I am sending calculations in a json object each one second.

Also, shall I use exec or spawn child_process at my case?

Upvotes: 1

Views: 896

Answers (2)

Mountain
Mountain

Reputation: 211

If you want to take the way of adopting coffee-script and AMD-style loader, you may take a look at this weather simulation. I think this simulation is like your required ones. More details as below ...

Based on below packages:

  • zappajs: in which socket.io is just one component
  • camel: A server-side coffeescript environment with first-class requirejs AMD-style loader and server-side WebWorkers supports

Key points:

We still want to involve large amount of calculation, but currently it is in slow progress.

Upvotes: 1

Floby
Floby

Reputation: 2336

You should probably look into :

These are utilities for using Websockets with Node.js easily.

Also if your worker processes are written in Node.js, I would suggest using the cluster module to spawn them. Otherwise, spawn is cool.

Upvotes: 2

Related Questions