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

# Examples

> Runnable Node.js + TypeScript examples for building on the Radion WebSocket.

The **[radion-examples](https://github.com/radion-app/radion-examples)** repo has copy-paste, ready-to-run examples for every common WebSocket use case. Each one is a single [Node.js](https://nodejs.org) + TypeScript file built on the [`@radion-app/sdk`](https://github.com/radion-app/radion-typescript) package. You run it with [`tsx`](https://tsx.is), so there is no build step. The SDK handles the `X-API-Key` upgrade, reconnect, heartbeat, and resubscribe for you.

## Quickstart

```bash theme={null}
git clone https://github.com/radion-app/radion-examples
cd radion-examples
cp .env.example .env        # set RADION_API_KEY=sk_...
pnpm install                # @radion-app/sdk + tsx + dev types
pnpm run wallet-alerts 0xYOUR_WALLET
```

<Note>
  Need a key? Make one at [radion.app](https://radion.app), then see
  [Authentication](/websockets/authentication). Every example reads it from
  `RADION_API_KEY`. Never hard-code it or put it in the URL.
</Note>

## What's included

| Example                  | Channel                                  | Run                               |
| ------------------------ | ---------------------------------------- | --------------------------------- |
| Mirror a wallet's trades | `trading` (wallets)                      | `pnpm run copytrade 0xWALLET`     |
| Wallet alerts            | `wallets`                                | `pnpm run wallet-alerts 0xWALLET` |
| Whale trade feed         | `trading` (min\_usd)                     | `pnpm run whales 10000`           |
| Single-market monitor    | `markets`                                | `pnpm run market --token 0xTOKEN` |
| Mempool early alerts     | `trading` (confirmed: false) + `trading` | `pnpm run mempool`                |
| Resolution watcher       | `oracle` + `resolution`                  | `pnpm run resolutions`            |
| Resilient client         | `trading`                                | `pnpm run resilient`              |

## The SDK realtime client

Every example uses the realtime client from [`@radion-app/sdk`](https://github.com/radion-app/radion-typescript). It handles the production parts once for you:

* opens the socket with the `X-API-Key` header,
* reconnects with exponential back-off,
* sends your subscriptions again after each reconnect,
* sends an app-level [`ping`](/websockets/subscribe#ping),
* reconnects on [`lagged`](/websockets/frames#error-frames) and stops on `key_revoked`.

```ts theme={null}
import { Radion } from "@radion-app/sdk";

const radion = new Radion({ apiKey: process.env.RADION_API_KEY });

radion.realtime.onAnyChannel((e) => console.log(e.data));
radion.realtime.subscribe({
  id: "s1",
  channel: "trading",
  filters: { wallets: ["0x…"] },
});
await radion.realtime.connect();
```

See the [repo README](https://github.com/radion-app/radion-examples) for the full walkthrough, and the [channel catalogue](/websockets/channels/overview) for every payload shape.
