Skip to content

Instantly share code, notes, and snippets.

@dymurray
Created January 10, 2019 19:17
Show Gist options
  • Save dymurray/abb8b7ca4bfaa483175acda76f506849 to your computer and use it in GitHub Desktop.
Save dymurray/abb8b7ca4bfaa483175acda76f506849 to your computer and use it in GitHub Desktop.
<script>
var source = new EventSource("https://bitgraph.network/s/ewogICJ2IjogMywKICAicSI6IHsKICAgICJmaW5kIjogeyJvdXQuYjAiOiB7ICJvcCI6IDEwNiB9LCAib3V0LmUuYSI6ICJxenc1ZWR6N3F1MDl1cHFlaHU0dHZ4ODJraGM5azAwejJ1MHRxOXU4Y2
QifQogIH0sCiAgInIiOiB7CiAgICAiZiI6ICJbLltdIHwge21zZzogLm91dFswXS5zMX1dIgogIH0KfQ==");
source.onmessage = function(event) {
var data = JSON.parse(event.data)
console.log(data);
console.log(data.type);
if (data.type == "mempool") {
var key = data.data[0].msg;
if (key == "z") {
key = "A"
}
if (key == "x") {
key = "B"
}
document.getElementById("result").innerHTML += key + "<br>";
document.getElementById("result").scrollTop = document.getElementById("result").scrollHeight
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment