Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When a stop and restart ocurre, we lose the tracking #3

Open
Rantun opened this issue Sep 3, 2024 · 2 comments
Open

When a stop and restart ocurre, we lose the tracking #3

Rantun opened this issue Sep 3, 2024 · 2 comments

Comments

@Rantun
Copy link

Rantun commented Sep 3, 2024

When happen something like "[Client/Socket ERROR] Error closing websocket: tls: failed to send closeNotify alert (but connection was closed anyway): write tcp [2800:300:6f31:d730:1876:2c0d:65c:415a]:49273->[2a03:2880:f247:c6:face:b00c:0:167]:443: write: broken pipe" and you stop and restart the program... you lose all the tracking data.. is possible to have an saving data every 5 minutes in a csv or restore the old data?

@Rantun Rantun changed the title When a stop and restart ocurre, we loose the tracking When a stop and restart ocurre, we lose the tracking Sep 3, 2024
@Rantun
Copy link
Author

Rantun commented Sep 24, 2024

hello again, the same thing keeps happening, after several hours of running, the application has the following error..
21:40:59.308 [Client/Socket ERROR] Error reading from websocket: websocket: close 1006 (abnormal closure): unexpected EOF....
and then when restarting, all data is lost.

@Rantun
Copy link
Author

Rantun commented Sep 25, 2024

add this little routine to the status.html page to generate the output csv file for the contacts you select... it's not very elegant, but it's functional. Insert this code inside the HTML file, just before the tag.

<script> // Function to export contacts to CSV function exportToCSV() { const rows = []; // Add CSV header rows.push(["JID", "Username", "Status", "Time"]); // Get current time in format HH:MM:SS const currentTime = new Date().toLocaleTimeString(); // Traverses through the elements of each contact and extracts data document.querySelectorAll('.chart-container').forEach(container => { const jid = container.querySelector('.chart-title').textContent; const username = container.querySelector('.chart-username').textContent || 'Unknown'; const status = container.querySelector('.status-indicator').textContent; // Add each contact as a row in the CSV along with time rows.push([jid, username, status, currentTime]); }); // Convert the rows to CSV format let csvContent = "data:text/csv;charset=utf-8," + rows.map(e => e.join(",")).join("\n"); // Create a link for downloading the CSV file const encodedUri = encodeURI(csvContent); const link = document.createElement("a"); link.setAttribute("href", encodedUri); link.setAttribute("download", "contacts_status.csv"); // Simulates the click to start the download document.body.appendChild(link); link.click(); document.body.removeChild(link); console.log("CSV Exported at", currentTime); } // Export CSV every minute (60,000 ms) setInterval(exportToCSV, 60000); </script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant