39 lines
1018 B
HTML
39 lines
1018 B
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>Page Title</title>
|
||
|
<script src="./../../../dist/liquid.js"></script>
|
||
|
<script>
|
||
|
const init = async () => {
|
||
|
try {
|
||
|
const { websocket } = liquidJS();
|
||
|
|
||
|
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>
|