Skip to content

Instantly share code, notes, and snippets.

@kmcheung12
Last active May 12, 2016 04:13
Show Gist options
  • Save kmcheung12/3ec2662232684b909d143c9700a00c3e to your computer and use it in GitHub Desktop.
Save kmcheung12/3ec2662232684b909d143c9700a00c3e to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var ws = new WebSocket("ws://127.0.0.1:8080/websocket");
ws.onopen = function() {
setInterval(send, 3000, ws);
};
function send(websocket) {
websocket.send(Math.random());
}
ws.onmessage = function (evt) {
console.log(evt.data);
};
</script>
</head>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment