> ## Documentation Index
> Fetch the complete documentation index at: https://docs.generalrobotics.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# UniversalClient

## UniversalClient

Inherits from: `object`

Universal client that supports multiple connection types with fallback.

Provides automatic fallback between WebSocket, MCP, and HTTP protocols.
Ideal for robust applications that need to work in varying network
conditions.

### **init**

```python theme={null}
UniversalClient.__init__(robot_ip: str, port: int = 4774, preferred_connection: ConnectionType = ConnectionType.WEBSOCKET, fallback: bool = True, **kwargs) -> None
```

Initialize universal client.

<ResponseField name="Arguments">
  <ParamField query="robot_ip (str)" type="str" required>
    IP address of the robot
  </ParamField>

  <ParamField query="port (int)" type="int">
    Port number (default 4774)
  </ParamField>

  <ParamField query="preferred_connection (ConnectionType)" type="ConnectionType">
    Preferred connection type
  </ParamField>

  <ParamField query="fallback (bool)" type="bool">
    Whether to fallback to other connection types if preferred fails \*\*kwargs: Additional parameters passed to underlying clients
  </ParamField>

  <ParamField query="kwargs" type="">
    *No description provided.*
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>

<ResponseField name="Raises">
  <ParamField query="ConnectionError" type="">
    If no connection can be established
  </ParamField>
</ResponseField>

### is\_connected

```python theme={null}
UniversalClient.is_connected() -> bool
```

Check if any client is connected

<ResponseField name="Returns">
  <ResponseField name="returns" type="bool" />
</ResponseField>

### get\_connection\_type

```python theme={null}
UniversalClient.get_connection_type() -> Optional[ConnectionType]
```

Get the active connection type.

<ResponseField name="Returns">
  <ResponseField name="Optional[ConnectionType]" type="Optional[ConnectionType]">
    The currently active connection type, or None if no connection is established
  </ResponseField>
</ResponseField>

### disconnect

```python theme={null}
UniversalClient.disconnect()
```

Disconnect from robot
