{TametheBots}

server-sent events

The Result:


            

Testing if an EventSource instance is created and used.

            <script>
                const evtSource = new EventSource("https://testing.tamethebots.com/events.php");
                evtSource.addEventListener("ping", (event) => {
                    const current = document.getElementById("results").innerText;
                    const e = JSON.parse(event.data);
                    document.getElementById("results").innerText = `${current}Time: ${e.time} Count: ${e.count}\n`;
        
                });
            </script>

< Back