# `Pixir.Provider.WebSocketClient`
[🔗](https://github.com/Ranvier-Technologies/pixir/blob/main/lib/pixir/provider/websocket_client.ex#L1)

Minimal Responses WebSocket client used by the production Provider connection.

The client intentionally emits the data-only SSE-shaped chunks that the default
ChatGPT/Codex reducer already knows how to fold. This keeps that model-event parser in
one place while the connection process owns socket lifetime and continuation state.
Profiles that require a named `event:` field must not enable this transport until the
adapter projects the JSON `type` into a matching event name; the initial strict
`open_responses` profile is therefore gated to HTTP/SSE by `ResponsesBackend`.

# `handshake`

```elixir
@type handshake() :: %{status: integer() | nil, status_line: String.t()}
```

# `socket`

```elixir
@type socket() :: term()
```

# `close`

```elixir
@spec close(socket() | nil) :: {:ok, :noop | :closed} | {:error, term()}
```

# `connect`

```elixir
@spec connect(String.t(), [{String.t(), String.t()}], keyword()) ::
  {:ok, socket(), binary(), handshake()} | {:error, map()}
```

# `ping`

```elixir
@spec ping(socket()) :: :ok | {:error, term()}
```

# `stream`

```elixir
@spec stream(socket(), binary(), map(), acc, (term(), acc -&gt; acc), keyword()) ::
  {:ok, acc, map()} | {:error, map(), acc}
when acc: term()
```

---

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