Skip to main content

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

UniversalClient.__init__(robot_ip: str, port: int = 4774, preferred_connection: ConnectionType = ConnectionType.WEBSOCKET, fallback: bool = True, **kwargs) -> None
Initialize universal client.
Arguments
robot_ip (str)
str
required
IP address of the robot
port (int)
int
Port number (default 4774)
preferred_connection (ConnectionType)
ConnectionType
Preferred connection type
fallback (bool)
bool
Whether to fallback to other connection types if preferred fails **kwargs: Additional parameters passed to underlying clients
kwargs
No description provided.
Returns
returns
None
Raises
ConnectionError
If no connection can be established

is_connected

UniversalClient.is_connected() -> bool
Check if any client is connected
Returns
returns
bool

get_connection_type

UniversalClient.get_connection_type() -> Optional[ConnectionType]
Get the active connection type.
Returns
Optional[ConnectionType]
Optional[ConnectionType]
The currently active connection type, or None if no connection is established

disconnect

UniversalClient.disconnect()
Disconnect from robot