Turning my 3D application into a server with node.js... Possible?

I have a 3d application that allows scripting via Javascript files. Is there a way to launch node.js from that file and create a server of sorts to communicate with the 3D application?

Many thanks for ideas and alternatives!

Probably not. nodejs has a os-specific binary part (i.e. it's not pure JavaScript). Also, the 3D JavaScript interpreter would fight with the one from nodejs and the results wouldn't be pretty.

If the JavaScript dialect of your 3D application allows to open sockets (AJAX, maybe?), then you can use that to talk to a nodejs instance which is running independently.

You can't start nodejs from a plain javascript file. You can create a nodejs server separately and to send a request from your 3d application javascript files to the tcp/http server and to start processing the data you want.

the simplest example: Javascript from your 3d :

get data from url : 192.168.1.1:3000

$.get("http://192.168.1.1:3000/myrequest",function(data){
  console.log(data)
});

nodejs server started at: 192.168.1.1:3000 on request / process data

 var http = require('http');
    http.createServer(function(req,res){
       if(req.url=="myrequest")
       {
           process data..
       }

    }).listen(3000);