От страна на моя сървър използвам записващ поток, за да записвам променящите се данни на всички клиенти, които са свързани към сървъра. Ето какво написах:
function updateLoop () {
var data = {'timeStep': timeStep, 'playerInfo': playerInfo};
var text = JSON.stringify(data);
writeStram.write(text + '\n');
timeStep += 1;
}
...
updateTimer = setInterval(updateLoop, 50);
So the function updateLoop() is called every 50ms.
It works when 'playerInfo' is small (less than 1KB), for example, after the server side running for 20s, there are 20*1000/50 = 400 lines of data in the output file
But when 'playerInfo' became larger, like 6KB or more, after the server side running for 20s, there only 220 lines of data in the output file. The larger playerInfo is, the lesser lines of successfully recorded data in the output file there is.Чудя се дали има някакво ограничение за скоростта на извикване на метода write()
Благодаря много за помощта на вашите момчета!
writeStream.write(text + '\n', updateLoop);
- person Patrick McElhaney   schedule 25.09.2012