Sha256: 811f1170e4d0e8d4d216f0a5213556e7d81ccc843c9991647ee8a717cb26a058

Contents?: true

Size: 881 Bytes

Versions: 14

Compression:

Stored size: 881 Bytes

Contents

<!doctype html>
<html lang="en">
<head>
  <title>Websocket Client</title>
</head>
<body>
  <script>
    var connect = function () {
      var exampleSocket = new WebSocket("ws://localhost:4411/");

      exampleSocket.onopen = function (event) {
        document.querySelector('#status').innerText = 'connected';
        exampleSocket.send("Can you hear me?");
      };
      exampleSocket.onclose = function (event) {
        document.querySelector('#status').innerText = 'disconnected';
        setTimeout(function () {
          // exampleSocket.removeAllListeners();
          connect();
        }, 1000);
      }
      exampleSocket.onmessage = function (event) {
        document.querySelector('#msg').innerText = event.data;
        console.log(event.data);
      }
    };

    connect();
  </script>
  <h1 id="status">disconnected</h1>
  <h1 id="msg"></h1>
</body>
</html>

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
tipi-0.55 examples/ws_page.html
tipi-0.54 examples/ws_page.html
tipi-0.53 examples/ws_page.html
tipi-0.52 examples/ws_page.html
tipi-0.51 examples/ws_page.html
tipi-0.50 examples/ws_page.html
tipi-0.49 examples/ws_page.html
tipi-0.47 examples/ws_page.html
tipi-0.46 examples/ws_page.html
tipi-0.45 examples/ws_page.html
tipi-0.43 examples/ws_page.html
tipi-0.42 examples/ws_page.html
tipi-0.41 examples/ws_page.html
tipi-0.40 examples/ws_page.html