41 lines
1.0 KiB
HTML
41 lines
1.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Page Title</title>
|
|
<script src="./../../../../dist/mempool.js"></script>
|
|
<script>
|
|
const init = async () => {
|
|
try {
|
|
const {
|
|
bitcoin: { websocket },
|
|
} = mempoolJS();
|
|
|
|
const ws = websocket.initClient({
|
|
options: ['blocks', 'stats', 'mempool-blocks', 'live-2h-chart'],
|
|
});
|
|
|
|
ws.addEventListener('message', function incoming({data}) {
|
|
const res = JSON.parse(data.toString());
|
|
if (res.blocks) {
|
|
console.log(res.blocks);
|
|
}
|
|
if (res.mempoolInfo) {
|
|
console.log(res.mempoolInfo);
|
|
}
|
|
if (res.transactions) {
|
|
console.log(res.transactions);
|
|
}
|
|
if (res.mempoolBlocks) {
|
|
console.log(res.mempoolBlocks);
|
|
}
|
|
});
|
|
} catch (error) {
|
|
console.log(error);
|
|
}
|
|
};
|
|
init();
|
|
</script>
|
|
</head>
|
|
<body></body>
|
|
</html>
|