# `Bourse.WS.Envelope`
[🔗](https://github.com/ZenHive/bourse/blob/main/lib/bourse/ws/envelope.ex#L1)

Builds WS message envelope config for routing inbound frames.

Reads `websocket.dispatch.discriminators` from the exchange spec and merges
authored per-exchange envelope overrides (data field, unwrap_list,
match_type, shape_channels).

# `envelope`

```elixir
@type envelope() :: %{optional(String.t()) =&gt; term()}
```

# `for_exchange`

```elixir
@spec for_exchange(Bourse.Exchange.t()) :: envelope() | nil
```

Returns envelope config for an exchange, or nil when routing is unavailable.

# `match_type`

```elixir
@spec match_type(envelope() | nil) :: String.t()
```

Returns the match strategy for an exchange envelope.

# `prefix_channels`

```elixir
@spec prefix_channels(envelope() | nil) :: [String.t()]
```

Returns prefix channel keys that need prefix matching (e.g. OKX `candle`).

# `shape_channels`

```elixir
@spec shape_channels(envelope() | nil) :: [map()]
```

Returns authored payload-shape → channel fallbacks when `e` (or equivalent) is absent.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
