My goal is to show a log file in real time. I'm doing it through a websocket, but when the paragraph ('p') of the html starts to be big (450 lines), Chrome starts lagging and crashing.
The implementation is this:
var paragraph = document.getElementById('idLog');
stompClient.subscribe('/suscribers/tomcatlog', function (data) {
var lineLog = JSON.parse(data.body);
if (lineLog.line !== null) {
paragraph.innerHTML += lineLog.line;
paragraph.appendChild(document.createElement("br"));
var elem = document.getElementById('main');
elem.scrollTop = elem.scrollHeight;
}
});
Why is this happening?