Sha256: e560573a443f8f477edf51f6e1d2d29441a4994d0e5cf4c0fe3d10f28a330837

Contents?: true

Size: 1.86 KB

Versions: 19

Compression:

Stored size: 1.86 KB

Contents

<!doctype html>
<html><head>
    <script src="//cdn.jsdelivr.net/jquery/2.1.4/jquery.min.js"></script>
    <script src="//cdn.jsdelivr.net/sockjs/1.0.1/sockjs.min.js"></script>
    <style>
      .box {
          width: 300px;
          float: left;
          margin: 0 20px 0 20px;
      }
      .box div, .box input {
          border: 1px solid;
          -moz-border-radius: 4px;
          border-radius: 4px;
          width: 100%;
          padding: 0px;
          margin: 5px;
      }
      .box div {
          border-color: grey;
          height: 300px;
          overflow: auto;
      }
      .box input {
          height: 30px;
      }
      h1 {
          margin-left: 30px;
      }
      body {
          background-color: #F0F0F0;
          font-family: "Arial";
      }
    </style>
</head><body lang="en">
    <h1>SockJS Express example</h1>

    <div id="first" class="box">
      <div></div>
      <form><input autocomplete="off" value="Type here..."></input></form>
    </div>

    <script>
        var sockjs_url = '/echo';
        var sockjs = new SockJS(sockjs_url);
        $('#first input').focus();

        var div  = $('#first div');
        var inp  = $('#first input');
        var form = $('#first form');

        var print = function(m, p) {
            p = (p === undefined) ? '' : JSON.stringify(p);
            div.append($("<code>").text(m + ' ' + p));
            div.append($("<br>"));
            div.scrollTop(div.scrollTop()+10000);
        };

        sockjs.onopen    = function()  {print('[*] open', sockjs.protocol);};
        sockjs.onmessage = function(e) {print('[.] message', e.data);};
        sockjs.onclose   = function()  {print('[*] close');};

        form.submit(function() {
            print('[ ] sending', inp.val());
            sockjs.send(inp.val());
            inp.val('');
            return false;
        });

    </script>
</body></html>

Version data entries

19 entries across 19 versions & 9 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/sockjs/examples/koa/index.html
disco_app-0.18.0 test/dummy/node_modules/sockjs/examples/koa/index.html
disco_app-0.18.2 test/dummy/node_modules/sockjs/examples/koa/index.html
enju_library-0.3.8 spec/dummy/node_modules/sockjs/examples/koa/index.html
ilog-0.4.1 node_modules/sockjs/examples/koa/index.html
ilog-0.4.0 node_modules/sockjs/examples/koa/index.html
ilog-0.3.3 node_modules/sockjs/examples/koa/index.html
jester-data-8.0.0 node_modules/sockjs/examples/koa/index.html
ezii-os-5.2.1 node_modules/sockjs/examples/koa/index.html
ezii-os-2.0.1 node_modules/sockjs/examples/koa/index.html
ezii-os-1.1.0 node_modules/sockjs/examples/koa/index.html
ezii-os-1.0.0 node_modules/sockjs/examples/koa/index.html
ezii-os-0.0.0.1.0 node_modules/sockjs/examples/koa/index.html
ezii-os-0.0.0.0.1 node_modules/sockjs/examples/koa/index.html
optimacms-0.4.3 spec/dummy/node_modules/sockjs/examples/koa/index.html
optimacms-0.4.2 spec/dummy/node_modules/sockjs/examples/koa/index.html
cortex-0.1.3 spec/dummy/node_modules/sockjs/examples/koa/index.html
dragonfly_puppeteer-0.1.0 node_modules/sockjs/examples/koa/index.html
lanes-0.8.0 node_modules/sockjs/examples/koa/index.html