livereload-server 0.2.2

A server to serve static content and automatically reload it one a file in a directory has been changed
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
if ("WebSocket" in window) {
  (function () {
    var protocol = window.location.protocol === "http:" ? "ws://" : "wss://";

    var address =
      protocol + window.location.host + window.location.pathname + "/ws";

    var socket = new WebSocket(address);

    socket.onmessage = function (msg) {
      if (msg.data == "reload") window.location.reload();
    };
  })();
} else {
  console.error(
    "Upgrade your browser. This Browser does NOT supported WebSocket, and cannot do live reloading."
  );
}