Created
March 11, 2015 15:26
-
-
Save g-p-g/7ad02b8df52414679ee0 to your computer and use it in GitHub Desktop.
Coinapult sockjs ticker
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> | |
<script src="https://cdn.jsdelivr.net/sockjs/0.3.4/sockjs.min.js"></script> | |
</head> | |
<body> | |
<p>Index: <span id="index">-</span></p> | |
<p>Last Update: <span id="when">never</span></p> | |
<script> | |
var sock = new SockJS('https://stream.coinapult.com:8123'); | |
sock.onmessage = function(evt) { | |
var data = JSON.parse(evt.data); | |
if (data.type == 'ticker') { | |
document.getElementById('index').innerHTML = data.index; | |
document.getElementById('when').innerHTML = new Date(); | |
} | |
}; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment