epiquery2
Version:
run templated queries from the http's using learnings from 1
50 lines (44 loc) • 1.16 kB
HTML
<meta charset="UTF-8">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title></title>
<script src="http://cdn.sockjs.org/sockjs-0.3.min.js"></script>
<script type="text/javascript">
function show(message){
var container = document.createElement('p');
container.innerHTML = message;
body = document.getElementsByTagName('body')[0];
body.appendChild(container);
}
var ws = new SockJS("/sockjs");
ws.onopen = function()
{
var req = {
templateName:"/test/servername",
connectionName:"render",
queryId:"pants"
}
ws.send(JSON.stringify(req));
show("Message is sent...");
};
ws.onmessage = function (evt)
{
var received_msg = evt.data;
show("Message: " + evt.data);
};
ws.onclose = function()
{
// websocket is closed.
show("Connection is closed...");
};
function EpiSocketClient(hostname){
var host = hostname;
var ws = new SockJS("ws://" + hostname + "/sockjs");
}
</script>
</head>
<body>
</body>
</html>