> ## 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

> Mobula provides WSS support for retrieving any raw events and curated events (i.e. Swaps, Liquidity).

<Tip> This endpoint is only available to Growth and Enterprise plans. </Tip>

## WebSocket

Mobula provides WSS support for retrieving any raw events and curated events like Swaps or Liquidity.

### Endpoint details

* URL: wss\://production-stream.mobula.io
* Message (string):

```json theme={null}
{
    "name": "MyWalletTransactions",
    "chainIds": ["evm:1", "evm:56"],
    "events": ["trace", "log", "transaction", "block", "swap", "transfer", "pool"],
};
```

### Parameters

* chainIds: [details here](/blockchains/intro-blockchains)
* events: transactions, traces, logs, blocks, swaps, transfers, pools
* filters: [details here](/indexing-stream/stream/filters)

### Implementation example

Let's take a look at:

Coming soon.

<Tip>You can use the Network tab in your browser to see the WSS requests. </Tip>

```typescript theme={null}
const socket = new WebSocket("wss://production-stream.mobula.io");

socket.addEventListener("open", () => {
  socket.send(`{
    "type": "stream",
    "payload": {
      "chainIds": ["evm:1", "evm:56"],
      "events": ["trace", "log", "transaction", "block", "swap", "transfer", "pool"],
    }
}`);
});

socket.addEventListener("message", (event) => {
  const data = JSON.parse(event.data);

  if (event.reorg) {
    // Handle reorg
    return;
  }
});

// No need to close the socket, it will close automatically.
```

### Connection Keepalive (Ping/Pong)

To maintain active WebSocket connections and prevent timeouts, you can use the ping/pong mechanism:

**Send ping:**

```json theme={null}
{"event":"ping"}
```

**Receive pong:**
The server will respond with a pong message to confirm the connection is active.

<Tip>Use ping messages periodically (every 30-60 seconds) to keep long-lived connections alive.</Tip>

## Webhook

Mobula provides Webhook support for retrieving any raw events and curated events like Swaps or Liquidity.

### Endpoint details

* URL: [https://production-stream.mobula.io/api/1/webhooks](https://production-stream.mobula.io/api/1/webhooks)
* Body (json):

```json theme={null}
{
    "name": "MyFirstWebhook",
    "chainIds": ["evm:1", "evm:56"],
    "events": ["trace", "log", "transaction", "block", "swap", "transfer", "pool"],
    "apiKey": "xxxxxxxxxx",
    "url": "https://webhook.com/xxxxxxxxxxx",
};
```

### Parameters

* chainIds: [details here](/blockchains/intro-blockchains)
* events: transactions, traces, logs, blocks, swaps, transfers, pools
* filters: [details here](/indexing-stream/stream/filters)
* webhookUrl: URL to send the data

### Create a webhook

First we need to create a webhook:

```typescript theme={null}
await fetch(url, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: {
  "name": "FirstWebhook",
  "chainIds": ["evm:1"],
  "events": ["trace"],
  "apiKey": "xxxxx",
  "filters": {
    "eq": ["action.input", "0xd55ec697"]
  },
  "url": "https://webhook.com/xxxxx"
  }
});
```

<Tip> The API key is mandatory to create a webhook. </Tip>

If you receive data from your webhook in response, then your webhook is functional and will start receiving events.

### Delete a webhook

To delete a webhook:

```typescript theme={null}
await fetch(url + `/${webhook_id}`, {
      method: 'DELETE',
      headers: {
        'Content-Type': 'application/json',
      },
    });
```

If you receive:

```json theme={null}
{
    "message": "Stream deleted successfully"
}
```

Then your webhook is deleted.

Can’t find what you’re looking for? Reach out to us, response times \< 1h.

<CardGroup>
  <Card title="Support" icon="Telegram" href="https://t.me/mobuladevelopers?start=Mobula_API_Support_Key">
    Telegram
  </Card>

  <Card title="Support" icon="Slack" href="https://join.slack.com/t/mobulaapi/shared_invite/zt-29zrrpjnl-I0tyD73sy7zKy8q~KLL3Ug">
    Slack
  </Card>

  <Card title="Need help?" icon="envelope" href="mailto:contact@mobulalabs.org">
    Email
  </Card>
</CardGroup>
