Connect
Connect to the same host at /api/v1/ws and send init for the current snapshot. Basechain blocks are selected by default. Add ?workchain=-1 for the masterchain, or ?workchain=0&shard=... for a basechain shard. Use the REST API for individual accounts, NFTs, transactions and traces.
Request
const socket = new WebSocket('wss://ton.tx.taxi/api/v1/ws');
socket.addEventListener('open', () => {
socket.send(JSON.stringify({ action: 'init' }));
});
socket.addEventListener('message', event => {
const snapshot = JSON.parse(event.data);
if (snapshot.ton) console.log(snapshot.ton.head);
});