The WebSocket API enables real-time order tracking for cross-chain swaps. Instead of repeatedly polling the API for status updates, your application receives instant notifications when order events occur.

## Why Use WebSocket?

For applications that need responsive user interfaces or automated trading systems, WebSocket provides significant advantages:

- **Instant Updates** — Receive order events within milliseconds instead of waiting for poll intervals
- **Reduced API Load** — A single persistent connection replaces hundreds of status requests
- **Complete Event History** — Track all state changes including partial fills, not just final status

## Order Events

The WebSocket API notifies you of these order lifecycle events:

- **order_created** — Your order has been submitted and is visible to resolvers
- **order_filled** — The order was completely filled by a resolver
- **order_filled_partially** — Part of your order was filled (for large orders)
- **order_invalid** — The order became invalid due to cancellation, expiry, or insufficient balance

## Connection

The WebSocket connects to:

```
wss://api.1inch.com/fusion-plus/ws
```

The SDK appends the version path automatically.

## Interactive Code Example

<stackblitz example="cross-chain-swap" file="src/websocket-order-tracking.ts" />
