Created
September 11, 2018 16:12
-
-
Save chappjc/f5605d4dfe8a0078f1b4355290495278 to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
| <meta charset="utf-8"/> | |
| </head> | |
| <body> | |
| <div id="updates"></div> | |
| <script src="https://alpha.dcrdata.org/js/socket.io.slim.js"></script> | |
| <script> | |
| var socket = io('https://alpha.dcrdata.org', {path: '/insight/socket.io', transports: ['websocket'], upgrade: false}); | |
| var updates = document.getElementById('updates') | |
| var update = function(str) { | |
| var pr = document.createElement('p') | |
| pr.textContent = str | |
| updates.appendChild(pr) | |
| } | |
| socket.on('connect', function() { | |
| update('Connected'); | |
| }) | |
| socket.on('tx', function(data) { | |
| update("New transaction received: " + JSON.stringify(data, null, 4)) | |
| }) | |
| socket.on('block', function(data) { | |
| update("New block received: " + JSON.stringify(data, null, 4)) | |
| }) | |
| socket.on('status', function(data) { | |
| update("Status: " + JSON.stringify(data, null, 4)) | |
| }) | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment