mirror of
https://github.com/mempool/mempool.git
synced 2025-03-03 17:47:01 +01:00
Change websocket examples.
This commit is contained in:
parent
1eedcf900b
commit
a0624df06b
2 changed files with 13 additions and 5 deletions
|
@ -3429,16 +3429,16 @@ export class ApiDocsComponent implements OnInit {
|
||||||
ws.addEventListener('message', function incoming({data}) {
|
ws.addEventListener('message', function incoming({data}) {
|
||||||
const res = JSON.parse(data.toString());
|
const res = JSON.parse(data.toString());
|
||||||
if (res.blocks) {
|
if (res.blocks) {
|
||||||
document.getElementById("result").textContent = JSON.stringify(res.blocks, undefined, 2);
|
document.getElementById("result-blocks").textContent = JSON.stringify(res.blocks, undefined, 2);
|
||||||
}
|
}
|
||||||
if (res.mempoolInfo) {
|
if (res.mempoolInfo) {
|
||||||
document.getElementById("result").textContent = JSON.stringify(res.mempoolInfo, undefined, 2);
|
document.getElementById("result-mempool-info").textContent = JSON.stringify(res.mempoolInfo, undefined, 2);
|
||||||
}
|
}
|
||||||
if (res.transactions) {
|
if (res.transactions) {
|
||||||
document.getElementById("result").textContent = JSON.stringify(res.transactions, undefined, 2);
|
document.getElementById("result-transactions").textContent = JSON.stringify(res.transactions, undefined, 2);
|
||||||
}
|
}
|
||||||
if (res.mempoolBlocks) {
|
if (res.mempoolBlocks) {
|
||||||
document.getElementById("result").textContent = JSON.stringify(res.mempoolBlocks, undefined, 2);
|
document.getElementById("result-mempool-blocks").textContent = JSON.stringify(res.mempoolBlocks, undefined, 2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
|
|
|
@ -172,6 +172,14 @@ init();`;
|
||||||
importText = `<script src="https://liquid.network/liquid.js"></script>`;
|
importText = `<script src="https://liquid.network/liquid.js"></script>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let resultHtml = '<pre id="result"></pre>';
|
||||||
|
if (this.method === 'websocket') {
|
||||||
|
resultHtml = `<pre id="result-blocks"></pre>
|
||||||
|
<pre id="result-mempool-info"></pre>
|
||||||
|
<pre id="result-transactions"></pre>
|
||||||
|
<pre id="result-mempool-blocks"></pre>`;
|
||||||
|
}
|
||||||
|
|
||||||
return `<!DOCTYPE html>
|
return `<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -184,7 +192,7 @@ init();`;
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<pre id="result"></pre>
|
${resultHtml}
|
||||||
</body>
|
</body>
|
||||||
</html>`;
|
</html>`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue