The WebSocket API enables real-time order tracking for production applications. 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

## Interactive Code Example

Explore the complete implementation — this example demonstrates creating a swap order and tracking its progress via WebSocket events:

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