comparison mod_http_stats_stream/example.html @ 2432:47a6f01231b2

mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
author Kim Alvefur <zash@zash.se>
date Wed, 04 Jan 2017 09:18:34 +0100
parents
children 1908e7aefca9
comparison
equal deleted inserted replaced
2431:623e23190c3e 2432:47a6f01231b2
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="UTF-8">
5 <title>Stats</title>
6 </head>
7 <body>
8 <h1>Glorious statistics!</h1>
9 <script>
10
11 var evtSource = new EventSource("/streamstats");
12
13 evtSource.addEventListener("stats-full", function(e) {
14 var initial_stats = JSON.parse(e.data);
15 console.log(initial_stats);
16
17 }, false);
18
19 evtSource.addEventListener("stats-updated", function(e) {
20 var updated_stats = JSON.parse(e.data);
21 console.log(updated_stats);
22
23 }, false);
24
25 </script>
26 </body>
27 </html>