# `ExUtcp.Transports.WebRTC.ConnectionBehaviour`
[🔗](https://github.com/universal-tool-calling-protocol/elixir-utcp/blob/main/lib/ex_utcp/transports/webrtc/connection_behaviour.ex#L1)

Behaviour for WebRTC Connection modules.

This allows for mocking in tests.

# `call_tool`

```elixir
@callback call_tool(
  pid :: pid(),
  tool_name :: String.t(),
  args :: map(),
  timeout :: integer()
) :: {:ok, map()} | {:error, term()}
```

Calls a tool over the WebRTC data channel.

# `call_tool_stream`

```elixir
@callback call_tool_stream(
  pid :: pid(),
  tool_name :: String.t(),
  args :: map(),
  timeout :: integer()
) :: {:ok, Enumerable.t()} | {:error, term()}
```

Calls a tool stream over the WebRTC data channel.

# `close`

```elixir
@callback close(pid :: pid()) :: :ok
```

Closes the WebRTC connection.

# `get_connection_state`

```elixir
@callback get_connection_state(pid :: pid()) :: atom()
```

Gets the connection state.

# `get_ice_connection_state`

```elixir
@callback get_ice_connection_state(pid :: pid()) :: atom()
```

Gets the ICE connection state.

# `start_link`

```elixir
@callback start_link(
  provider :: map(),
  signaling_server :: String.t(),
  ice_servers :: [map()]
) ::
  {:ok, pid()} | {:error, term()}
```

Starts a new WebRTC connection.

---

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