forked from mempool/mempool.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
websocket.html
53 lines (42 loc) · 1.56 KB
/
websocket.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!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.wsInitBrowser();
ws.addEventListener('message', function incoming({data}) {
console.log(JSON.parse(data.toString()));
});
websocket.wsWantDataBrowser(ws, ['blocks', 'stats', 'mempool-blocks', 'live-2h-chart']);
websocket.wsTrackAddressBrowser(ws, "1wizSAYSbuyXbt9d8JV8ytm5acqq2TorC");
websocket.wsTrackAddressesBrowser(ws, [
"1wizSAYSbuyXbt9d8JV8ytm5acqq2TorC",
]);
websocket.wsTrackTransactionBrowser(ws, "01313ca0148a1bbe5676e5dd6a84e76f8b39038658bd8c333d3b2d3f7ea6dd08");
websocket.wsTrackRbfSummaryBrowser(ws);
websocket.wsTrackRbfBrowser(ws, true);
websocket.wsTrackMempoolBlockBrowser(ws, 1);
setTimeout(() => {
websocket.wsStopDataBrowser(ws);
websocket.wsStopTrackingAddressBrowser(ws);
websocket.wsStopTrackingAddressesBrowser(ws);
websocket.wsStopTrackingTransactionBrowser(ws);
websocket.wsStopTrackingRbfSummaryBrowser(ws);
websocket.wsStopTrackingRbfBrowser(ws);
websocket.wsStopTrackingMempoolBlockBrowser(ws);
}, 60000);
} catch (error) {
console.log(error);
}
};
init();
</script>
</head>
<body></body>
</html>