mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
add test for long log messages
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
// used to simulate
|
||||
// - file uploads
|
||||
// - EventSource (SSE) for log messages
|
||||
import formidable from 'formidable';
|
||||
|
||||
function pad(number) {
|
||||
@@ -99,15 +102,21 @@ export default () => {
|
||||
|
||||
let count = 0;
|
||||
const interval = setInterval(() => {
|
||||
let message = 'message #' + count;
|
||||
if (count % 6 == 1) {
|
||||
message +=
|
||||
' with a long message that will be wrapped, to see if it stays one a single line';
|
||||
}
|
||||
const data = {
|
||||
t: new Date().toISOString(),
|
||||
l: 3 + (count % 6),
|
||||
i: count,
|
||||
n: 'system',
|
||||
m: 'message #' + count++
|
||||
m: message
|
||||
};
|
||||
count++;
|
||||
res.write(`data: ${JSON.stringify(data)}\n\n`);
|
||||
}, 1000);
|
||||
}, 800);
|
||||
|
||||
// if client closes connection
|
||||
res.on('close', () => {
|
||||
|
||||
Reference in New Issue
Block a user