Send a ping request to the server to verify connectivity. Args: message: Optional message to include in the ping. Returns: A PingResponse object containing the ping response. Raises: RuntimeError: If the client is not connected.
(self, message: str | None = None)
| 2864 | return session |
| 2865 | |
| 2866 | async def ping(self, message: str | None = None) -> PingResponse: |
| 2867 | """ |
| 2868 | Send a ping request to the server to verify connectivity. |
| 2869 | |
| 2870 | Args: |
| 2871 | message: Optional message to include in the ping. |
| 2872 | |
| 2873 | Returns: |
| 2874 | A PingResponse object containing the ping response. |
| 2875 | |
| 2876 | Raises: |
| 2877 | RuntimeError: If the client is not connected. |
| 2878 | |
| 2879 | Example: |
| 2880 | >>> response = await client.ping("health check") |
| 2881 | >>> print(f"Server responded at {response.timestamp}") |
| 2882 | """ |
| 2883 | if not self._client: |
| 2884 | raise RuntimeError("Client not connected") |
| 2885 | |
| 2886 | result = await self._client.request("ping", {"message": message}) |
| 2887 | return PingResponse.from_dict(result) |
| 2888 | |
| 2889 | async def get_status(self) -> GetStatusResponse: |
| 2890 | """ |