Sha256: 3e22659db943b52a5684a0643952b3cc81feb56321836dedcaa083f162de6b42
Contents?: true
Size: 1.52 KB
Versions: 2
Compression:
Stored size: 1.52 KB
Contents
<!DOCTYPE html> <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js?v=1"></script> <script type="text/javascript" charset="utf-8"> $(function() { var ws = new WebSocket("ws://127.0.0.1:8080"); ws.onmessage = function(e) { $("#result").append($("<div>").html(e.data)); $("body").scrollTop(document.height); }; ws.onclose = function() { $("#result").append($("<div class='alert'>").text("closed")); }; ws.onerror = function() { $("#result").append($("<div class='alert'>").text("error!")); }; $.eval = function() { ws.send($("#input").val()); $("#input").val('').focus(); } $('#input').keyup(function(e) { if(e.keyCode == 13) { $.eval() } }); $("#input").focus(); }); </script> <style type="text/css" media="screen"> body { padding: 10px; margin: 0; } pre { font-size: 13px; font-family: monospace; margin: 0; padding: 0; } #input { font-size: 13px; font-family: monospace; margin: 0; padding: 0; border: none; outline: none; } .alert { color: red; } </style> </head> <body> <pre><span id="result"></span><span id="prompt">> </span><input type="text" id="input" style="width: 400px" /></pre> </body> </html>
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ws-io-1.0.1 | examples/index.html |
ws-io-1.0.0 | examples/index.html |