Canonical: https://masterchain.ton.tx.taxi/docs/api/websocket

# WebSocket API

tx.taxi / TON explorer

## One search across chains.

Paste a transaction, block or address into tx.taxi. Open a confirmed match, choose between possible networks, or head straight to your chain’s explorer.

[Open tx.taxi ↗︎](https://tx.taxi/)
      [Explore TON →](/)

[TON Guide](/docs/faq)[REST API](/docs/api/rest)[WebSocket API](/docs/api/websocket)

## Live block updates

### 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);
});
```

### Current snapshot

The response includes recent normalized `blocks` from the selected workchain and shard, plus a `ton` object with the head, observed history, observation time and stale state. Use `ton.head` for complete selected-block fields and `ton.masterchainHead` for the network masterchain head. Send `{"action":"select","workchain":-1}` to switch an open connection to the masterchain.

#### Request

```
{"action":"init"}
```

### Keep the connection active

Send a ping to check the connection. On reconnect, send `init` again to obtain the current snapshot.

#### Request

```
{"action":"ping"}
```

#### Response

```
{"pong":true}
```

### Delayed updates

When `ton.stale` is true, retain the last available blocks and mark them as delayed. `ton.observedAt` is the observation timestamp. WebSocket connection health alone does not establish data freshness.

[About ton.tx.taxi](/about) · [Terms of Service](/terms-of-service) · [Privacy Policy](/privacy-policy) · [Brand attribution](/trademark-policy) · [TON Guide](/docs/faq) · [REST API](/docs/api/rest) · [WebSocket API](/docs/api/websocket)
