Connection¶
Runnable example
python/examples/connection_ping.py — calls Connection.Ping once and prints the round-trip time and server timestamp.
resoio.connection.ConnectionClient ¶
Bases: _BaseClient[ConnectionStub]
Async client for the Resonite IO Connection service over a UDS.
Use as an async context manager so the gRPC channel is closed
deterministically. With socket_path=None the path is resolved on
__aenter__ via RESONITE_IO_SOCKET →
RESONITE_IO_SOCKET_DIR → ~/.resonite-io/; resolution may
raise :class:SocketNotFoundError or :class:AmbiguousSocketError.
Source code in src/resoio/_client.py
ping
async
¶
Round-trip a liveness check and return the server's echo.
A healthy mod echoes message back unchanged, so callers can use
the round trip as a connectivity probe before opening other
modality streams.
| RETURNS | DESCRIPTION |
|---|---|
The
|
class:
TYPE:
|
PingResponse
|
the server-side response timestamp. |
| RAISES | DESCRIPTION |
|---|---|
GRPCError
|
The RPC failed at the transport or server layer (e.g. the mod went away mid-call). |
Source code in src/resoio/connection.py
resoio.connection.wait_for_ready
async
¶
wait_for_ready(
socket_path: str | None = None,
*,
timeout: float | None = None,
interval: float = 0.1,
) -> str
Block until the Resonite IO server answers Connection.Ping.
The startup-readiness gate: during cold boot the socket may be absent, bound with no listener yet, or bound by an engine that has not finished initialising. Each of those is retried; a healthy ping ends the wait and the resolved UDS path is returned.
With socket_path=None the path is re-resolved on every attempt via
the usual env order (RESONITE_IO_SOCKET → RESONITE_IO_SOCKET_DIR
→ ~/.resonite-io/), so a socket that appears mid-wait is picked up
and stale sockets whose owning engine PID is gone are skipped by the
resolver. Connecting directly (bypassing the modality client) keeps the
poll from firing the once-per-process version-mismatch probe each round.
| PARAMETER | DESCRIPTION |
|---|---|
socket_path
|
Explicit UDS path to wait on, or
TYPE:
|
timeout
|
Maximum seconds to wait.
TYPE:
|
interval
|
Seconds to sleep between attempts (clamped so the wait
never overshoots
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The resolved UDS path that answered the ping. |
| RAISES | DESCRIPTION |
|---|---|
TimeoutError
|
|
AmbiguousSocketError
|
Multiple live sockets matched and no explicit path was given — waiting cannot disambiguate, so it propagates. |
GRPCError
|
The server answered with a
non-retryable status. |
Source code in src/resoio/connection.py
resoio.SocketNotFoundError ¶
Bases: RuntimeError
No resonite-*.sock matched the configured search directory.
resoio.AmbiguousSocketError ¶
Bases: RuntimeError
Multiple candidate sockets found; set RESONITE_IO_SOCKET to pick
one.