我正在尝试运行 jxcore。但我不能。请帮帮我,因为我是新手。
服务器.js
var http = require("http");
jxcore.tasks.on('message', function (threadId, param) {
console.log('Main thread received a message from subthread no ' +
threadId + '. Message: ', param);
});
http.createServer(function(req,resp) {
console.log("Listening To Thread " + process.threadId);
resp.writeHead(200,{"Content-Type":"text/html"});
resp.end("Running JXCORE "+process.threadId);
}).listen(3000);
服务器jx.js
var method = function() {
try {
process.keepAlive();
require("server");
console.log("Welcome To NodeJS");
return {
someResult: "some result";
};
} catch(e) {
console.log("Error Occured : "+e);
return {"Error":e};
}
}
jxcore.tasks.runOnce(code, {count:1000}, function(obj) {
process.sendToMain({started:true});
console.log("Return Value " + obj);
setTimeout(function() {
console.log("Waiting For TimeOut 5 Sec");
}, 5000);
});
我在 cmd 上输入为jx server.js jx mt-keep server.js
我没有看到线程正在运行。请帮忙