> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solanatracker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Datastream: Solana WebSocket API for live data

> Stream live Solana prices, trades, wallets, and token events over one WebSocket connection. Join one room per feed, and load snapshots from the Data API.

Use Datastream when your app needs updates as they happen. Open one WebSocket connection, then join a room for each feed you want. To load a snapshot first, use the [Data API](https://docs.solanatracker.io/data-api/overview.md).

* **URL**: `wss://datastream.solanatracker.io/{apiKey}`
* **Authentication**: Your Data API key in the URL path
* **Plans**: Premium, Business, and Enterprise. See [pricing and limits](https://docs.solanatracker.io/pricing.md).

## Join a room

This example subscribes to the price of one token and replies to heartbeats:

```javascript theme={null}
const ws = new WebSocket("wss://datastream.solanatracker.io/YOUR_API_KEY");

ws.onopen = () => {
  ws.send(JSON.stringify({ type: "join", room: "price-by-token:TOKEN_MINT" }));
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);

  if (msg.type === "message") console.log(msg.room, msg.data);
  if (msg.type === "ping") ws.send(JSON.stringify({ type: "pong" }));
};
```

Read [Connect to Datastream](https://docs.solanatracker.io/guides/datastream-protocol.md) for the full message format, heartbeats, and connection errors.

## Find the room you need

| To follow | Start with |
| - | - |
| New tokens | [Latest tokens](https://docs.solanatracker.io/datastream/websockets/latesttokens.md) |
| Prices | [Price by pool](https://docs.solanatracker.io/datastream/websockets/pricebypool.md) |
| Trades | [Token transactions](https://docs.solanatracker.io/datastream/websockets/tokentransactions.md) |
| Liquidity changes | [Liquidity by token](https://docs.solanatracker.io/datastream/websockets/liquiditytoken.md) |
| Transfers | [Wallet transfers](https://docs.solanatracker.io/datastream/websockets/transferwallet.md) |
| A wallet | [Wallet transactions](https://docs.solanatracker.io/datastream/websockets/wallettransactions.md) |
| PnL | [Token position](https://docs.solanatracker.io/datastream/websockets/tokenposition.md) |
| Token risk | [Sniper tracking](https://docs.solanatracker.io/datastream/websockets/snipertracking.md) |

## Next steps

> [card] [Connect to Datastream](https://docs.solanatracker.io/guides/datastream-protocol.md)
>
> Authentication, heartbeats, and errors.

> [card] [Stream prices](https://docs.solanatracker.io/guides/datastream-prices.md)
>
> Choose a price room and handle updates.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.