Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions DataReplayer/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ function startSending() {
console.log('Starting to send data packets...');
console.log(`Sending at ~31Hz (32ms intervals) to localhost:${PORT}`);

setInterval(() => {
const sendInterval = setInterval(() => {
if (csvData.length === 0) return;

const currentRow = csvData[currentIndex];
Expand All @@ -278,7 +278,21 @@ function startSending() {
});

// Move to next row, loop back to start when done
currentIndex = (currentIndex + 1) % csvData.length;
currentIndex++;

// Log progress occasionally
if (currentIndex % 100 === 0) {
console.log(`Sent ${currentIndex} packets, timestamp: ${currentRow.Var1 || 'N/A'}`);
}

// Stop when finished
if (currentIndex >= csvData.length) {
console.log('All data packets sent. Stopping replay.');
clearInterval(sendInterval);
client.close();
process.exit(0);
}


// Log progress occasionally
if (currentIndex % 100 === 0) {
Expand Down