File size: 464 Bytes
319ab81
 
 
 
 
 
 
 
 
 
 
 
888246e
5008097
 
 
 
 
319ab81
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE html>
<html>
  <head>
    <title>Display</title>
  </head>
  <body>
    <h1>
      Display text
    </h1>

    <script>
      window.onload = () => {
        const eventSource = new EventSource('http://127.0.0.1:5555/test');
        eventSource.onmessage = (event) => {
          console.log("event", event);
          const data = JSON.parse(event.data);
          document.body.innerHTML = data.text;
        };
      }
    </script>
  </body>
</html>