-
-
Save alco/2477872 to your computer and use it in GitHub Desktop.
Simple HTML WebSocket client for the ZeroMQ gateway
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>ZWS Example</title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" ></script> | |
<script language='javascript'> | |
$(document).ready(function() { | |
var ws = new WebSocket("ws://localhost:9999/test"); | |
ws.onmessage = function(evt) { | |
$('#output').append(evt.data+'<br />'); | |
} | |
ws.onopen = function(evt) { | |
$('#conn_status').html('<b>Connected</b>'); | |
} | |
ws.onerror = function(evt) { | |
$('#conn_status').html('<b>Error</b>'); | |
} | |
ws.onclose = function(evt) { | |
$('#conn_status').html('<b>Closed</b>'); | |
} | |
}); | |
</script> | |
</head> | |
<body> | |
<h1>ZMQ - WebSocket Example</h1> | |
<div id="conn_status">Not Connected</div> | |
<div id="output"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment