Created
September 23, 2017 13:19
-
-
Save aerohit/fa0c40f45ab555e8cf78f2d7fa013f43 to your computer and use it in GitHub Desktop.
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> | |
<body> | |
<script src="https://blockexplorer.com/socket.io/socket.io.js"></script> | |
<script> | |
eventToListenTo = 'tx' | |
room = 'inv' | |
var socket = io("https://blockexplorer.com/"); | |
socket.on('connect', function() { | |
// Join the room. | |
socket.emit('subscribe', room); | |
}) | |
socket.on(eventToListenTo, function(data) { | |
console.log("New transaction received: " + data.txid); | |
console.log(data); | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment