Skip to content

Instantly share code, notes, and snippets.

@NorioKobota
Created September 15, 2015 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NorioKobota/3be9bbde030ccfe08070 to your computer and use it in GitHub Desktop.
Save NorioKobota/3be9bbde030ccfe08070 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>echo client</title>
<script type="text/javascript" src="./jquery.min.js"></script>
<script type="text/javascript" src="./linear.debug.js"></script>
<script type="text/javascript">
var c;
window.onload = function() {
var t1 = {type: 'websocket', host: '127.0.0.1', port: 8000};
c = new linear.client({transports: [t1]});
c.connect();
};
function send() {
c.request({method: 'echo', params:$('#echo').val(),
onresponse: function(m) {
$('#echoback').text(m.result);
}});
}
</script>
</head>
<body>
<h1>Echo client</h1>
<input id="echo" type="text"></input>
<button onclick="send()">send</button>
<div>echoback: <span id="echoback"></span></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment