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

# Get started

> Real-time WebSocket streams for market data, trades, positions, and more.

<Note>Price freshness (head lag vs chain tip) is measured live on [OpenChainBench](https://openchainbench.com/benchmarks/aggregator-head-lag), the open benchmark suite we built and open-sourced.</Note>

[![Mobula on OpenChainBench: price head lag](https://openchainbench.com/api/badge/aggregator-head-lag/mobula)](https://openchainbench.com/benchmarks/aggregator-head-lag)

Mobula provides real-time WebSocket streams for accessing live blockchain data with minimal latency. Whether you need market updates, trade feeds, or position tracking, our streaming API delivers data as it happens.

## TypeScript SDK (Recommended)

The easiest way to consume WebSocket streams is through our official SDK, which handles connection management, reconnection, and provides full type safety:

```bash theme={null}
npm install @mobula_labs/sdk
```

```typescript theme={null}
import { MobulaClient } from '@mobula_labs/sdk';

const client = new MobulaClient({
  apiKey: 'your-api-key', // Get one at https://admin.mobula.io
});

// Subscribe to market data
client.streams.subscribe('market', { asset: 'bitcoin' }, (data) => {
  console.log('Market update:', data);
});

// Subscribe to trades
client.streams.subscribe('trade', {
  asset: 'bitcoin',
  blockchain: 'ethereum',
  pair: 'WETH/USDC',
}, (data) => {
  console.log('Trade:', data);
});

// Subscribe to OHLCV candles
client.streams.subscribe('ohlcv', {
  asset: 'bitcoin',
  interval: '1h',
}, (data) => {
  console.log('OHLCV update:', data);
});

// Subscribe to Pulse V2
client.streams.subscribe('pulse-v2', {
  model: 'default',
  chainId: ['solana:solana'],
}, (data) => {
  console.log('Pulse update:', data);
});
```

### Available Stream Types

| Stream Type            | Description                 |
| ---------------------- | --------------------------- |
| `market`               | Market data updates         |
| `market-details`       | Detailed market information |
| `token-details`        | Token information updates   |
| `trade` / `fast-trade` | Trade updates               |
| `ohlcv`                | OHLCV candle updates        |
| `holders`              | Token holder updates        |
| `pulse-v2`             | Pulse V2 data stream        |
| `position`             | Position updates            |
| `funding`              | Funding rate updates        |
| `stream-evm`           | EVM blockchain stream       |
| `stream-svm`           | Solana blockchain stream    |

<Warning>
  WebSocket entity limits are enforced only for `market-details`, `token-details`, `fast-trade`, `pair`, and `ohlcv`, per organization, or per customer when no organization is attached. Across those active payloads, a single organization/customer can track at most **50 tokens**, **50 markets**, and **50 wallets**. If you need higher limits, reach out to the Mobula team.
</Warning>

### SDK Features

* **Automatic reconnection**: Connection drops are handled automatically
* **Heartbeat management**: Keep connections alive without manual intervention
* **Connection pooling**: Efficient management of multiple subscriptions
* **Full type safety**: TypeScript types for all stream payloads
* **Easy unsubscription**: Clean up resources with returned unsubscribe functions

```typescript theme={null}
// Unsubscribe when done
const unsubscribe = client.streams.subscribe('market', { asset: 'bitcoin' }, callback);

// Later...
unsubscribe();
```

<CardGroup>
  <Card title="NPM Package" icon="npm" href="https://www.npmjs.com/package/@mobula_labs/sdk">
    View on NPM
  </Card>

  <Card title="Need Help or Examples?" icon="support" href="https://t.me/mobuladevelopers">
    Contact Mobula support for live usage examples and integration help
  </Card>
</CardGroup>

## Direct WebSocket Connection

If you prefer to connect directly without the SDK, you can use the WebSocket endpoint:

**URL**: `wss://api.mobula.io`

Example subscription message:

```json theme={null}
{
  "type": "market-details",
  "authorization": "YOUR-API-KEY",
  "payload": {
    "pools": [
      {
        "blockchain": "evm:1",
        "address": "0x1234567890abcdef1234567890abcdef12345678"
      }
    ]
  }
}
```

<Note>
  The SDK handles authentication, message formatting, and connection management automatically. We recommend using it for production applications.
</Note>

## Stream Categories

<CardGroup>
  <Card title="Market & Token Data" icon="chart-line" href="/indexing-stream/stream/websocket/wss-market-details">
    Real-time market details and token information
  </Card>

  <Card title="Trades & OHLCV" icon="arrows-rotate" href="/indexing-stream/stream/websocket/wss-fast-trades">
    Live trade feeds and OHLCV candles
  </Card>

  <Card title="Pulse Streams" icon="wave-pulse" href="/indexing-stream/stream/websocket/pulse-stream-v2">
    Token pulse data with customizable filters
  </Card>

  <Card title="Positions & Holders" icon="users" href="/indexing-stream/stream/websocket/wss-position-stream">
    Track positions and holder changes in real-time
  </Card>
</CardGroup>

## Benchmarks

<Card title="Live Benchmarks" icon="gauge-high" href="/benchmarks">
  Real-time latency comparisons — see how Mobula streams compare to other crypto data providers.
</Card>
