summaryrefslogtreecommitdiff
path: root/node_modules/ws/examples/serverstats/public/index.html
blob: 24d84e120093a7e3911a271d8f56dd07823a0ac9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html>
  <head>
    <style>
      body {
        font-family: Tahoma, Geneva, sans-serif;
      }

      div {
        display: inline;
      }
    </style>
    <script>
      function updateStats(memuse) {
        document.getElementById('rss').innerHTML = memuse.rss;
        document.getElementById('heapTotal').innerHTML = memuse.heapTotal;
        document.getElementById('heapUsed').innerHTML = memuse.heapUsed;
      }

      var host = window.document.location.host.replace(/:.*/, '');
      var ws = new WebSocket('ws://' + host + ':8080');
      ws.onmessage = function (event) {
        updateStats(JSON.parse(event.data));
      };
    </script>
  </head>
  <body>
    <strong>Server Stats</strong><br>
    RSS: <div id='rss'></div><br>
    Heap total: <div id='heapTotal'></div><br>
    Heap used: <div id='heapUsed'></div><br>
  </body>
</html>