# `ZenWebsocket.Examples.Docs.SubscriptionManagement`
[🔗](https://github.com/ZenHive/zen_websocket/blob/v0.8.0/lib/zen_websocket/examples/docs/subscription_management.ex#L1)

Channel subscription flows over a WebSocket connection.

Sends multi-channel subscribe payloads with `Client.send_message/2` and consumes the
resulting `{:websocket_message, _}` frames the default handler forwards to the
calling process, both one at a time and in a collect-N loop.

# `handle_market_data`

```elixir
@spec handle_market_data(timeout()) ::
  {:market_update, String.t(), term()}
  | {:message, map()}
  | {:text_message, String.t()}
  | {:closed, term()}
  | {:error, :timeout}
```

Process market data updates with pattern matching.

# `multi_channel_subscription`

```elixir
@spec multi_channel_subscription() :: {:ok, ZenWebsocket.Client.t(), [String.t()]}
```

Subscribe to multiple data streams using echo server.

# `subscription_loop`

```elixir
@spec subscription_loop(ZenWebsocket.Client.t(), [String.t()], non_neg_integer()) ::
  {:ok, [term()]} | {:error, :timeout, [term()]}
```

Subscribe and process messages in a loop.

---

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