RpcClient: connect, request/response, ID routing #4
Labels
No labels
area:assertions
area:cli
area:client
area:harness
area:meta
area:reporting
area:runner
type:user-story
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/ws-rpc-test#4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
User story
As a test author, I want to send a JSON-RPC request and
awaitits response with one call, so that I never have to track message IDs or correlate responses by hand.Acceptance criteria
Connection
RpcClient::connect(url, token: Option<&str>)opens a WebSocket viatokio-tungstenite.tokenisSome, it is sent asAuthorization: Bearer <token>during the upgrade.Result<Self, TestError>; failures map toTestError::Connection.Concurrency model
Arc<Inner>with channels — so thatcall,subscribe,wait_for, andwait_for_anyall take&selfand can be safely called from cloned handles in different tasks. This resolves the spec-review §1 ergonomics issue.id) are forwarded to the buffer (handled in a separate issue).call / call_timeout
call(method, params) -> Result<Value, TestError>sends: whereNis auto-incremented per client (u64).resultfield asserde_json::Value.call_timeout(method, params, duration)lets callers override.TestError::Timeout { event: format!("call:{method}"), duration }.Err(TestError::RpcError { code, message }). This clarifies the spec-review §6 ambiguity:callreturnsOk(Value)only on JSON-RPC success, JSON-RPC errors becomeErr(RpcError).Value::Nullas params, the framework rewrites it to{}before sending (per spec §4.1).Out of scope
References