# `XGW.Spike.Server`
[🔗](https://github.com/Lazarus404/xgw/blob/main/spike/server.ex#L1)

Browser spike GenServer: one Listener + Peer, SDP answer, trickle ICE, status.

Started by `mix xgw.spike`; HTTP routes call `answer/2` and candidate helpers.

# `add_remote_candidate`

```elixir
@spec add_remote_candidate(map()) :: :ok | {:error, term()}
```

Trickles a remote ICE candidate into the Peer (`candidate` / `sdpMid` map).

# `answer`

```elixir
@spec answer(
  binary(),
  keyword()
) :: binary() | {:error, term()}
```

Builds and applies a local answer for `offer`, returning the SDP answer string.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `local_candidates_since`

```elixir
@spec local_candidates_since(non_neg_integer()) :: {[String.t()], non_neg_integer()}
```

Local candidate lines gathered since index `since` (trickle poll).

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

Starts the named spike server. Opts are forwarded to `XGW.Listener.start_link/1`
plus `:ice_tcp_only` for TCP-only answer candidates.

# `status`

```elixir
@spec status() :: map()
```

Returns a map of spike counters (ICE/DTLS/RTP/SCTP, transport, candidates).

---

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