node.jsサーバーとクライアント接続を開いたままにしておくことは悪い考えですか? (x.end();を使用しないでください)。node.jsにサーバークライアントの応答接続を開いたままにしておくのは悪いですか?
私はnode.jsで遊んでいて、ハングアップしています。これは私がやろうとしていることです: node.js実行可能ファイルをマルチクライアントのオープンハンドルとして使用して通信するお互いに、私がこれまでに試したことは、ちょうど意味のあるHTTPサーバーを作成し、5000msの間隔で「テスト」を作成することです。そして、切断するまでクライアントと永遠にやりとりするこのアイデアを持っているので、私は自分自身がハンドルを終了するのを見ることはできません。
var http = require("http"),
date = require("./modules/date.js");
var server = http.createServer(function(request, response) {
console.log("[" + date.currentTimestamp() + "] Receiving a connection from " + server.address().address);
response.writeHead(200, {"Content-Type": "text/html"});
response.write("Hello World!<br>Current time: " + date.currentTimestamp() + "<br>Current url: " + request.url);
setInterval(function() {
response.write(" test");
}, 5000);
}).listen(80);
console.log("[" + date.currentTimestamp() + "] Server has initialized.");
ソケットプロトコルの使用について言及するつもりは、OPが意図しているものの管理におそらく最適です。 – simon