Created
June 20, 2017 03:01
-
-
Save coinables/4439cb74a6b7763eeb4a916393535acf to your computer and use it in GitHub Desktop.
coincap.io with socket.io example
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.3/socket.io.js"></script> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var socket = io.connect('http://socket.coincap.io'); | |
socket.on('trades', function (tradeMsg) { | |
console.log(tradeMsg); | |
if(tradeMsg.message.coin == "ETH"){ | |
document.getElementById("ETH").innerHTML = tradeMsg.message.msg.price; | |
} | |
}) | |
</script> | |
ETH: | |
<div id="ETH"></div> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment