rdavydov / Twitch-Channel-Points-Miner-v2

A simple script that will watch a stream for you and earn the channel points.
GNU General Public License v3.0
1.11k stars 326 forks source link

Analytics log: rewrite the logic using long polling #414

Open rdavydov opened 7 months ago

rdavydov commented 7 months ago

Is your feature request related to a problem?

No response

Proposed solution

Analytics log: rewrite the logic using long polling

Alternatives you've considered

No response

Additional context

No response

rdavydov commented 7 months ago

Specifically this:

    // Function to get the full log content
    function getLog() {
        if (isLogCheckboxChecked) {
            $.get(`/log?lastIndex=${lastReceivedLogIndex}`, function (data) {
                // Process and display the new log entries received
                $("#log-content").append(data);
                // Scroll to the bottom of the log content
                $("#log-content").scrollTop($("#log-content")[0].scrollHeight);

                // Update the last received log index
                lastReceivedLogIndex += data.length;

                // Call getLog() again after a certain interval (e.g., 1 second)
                setTimeout(getLog, 1000);
            });
        }
    }

and the python backend part.