<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "Bitcoin",
  "identifier" : "/documentation/Bitcoin/DirectTransport/send(_:path:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Bitcoin"
    ],
    "preciseIdentifier" : "s:7Bitcoin15DirectTransportV4send_4path10Foundation4DataVAA14JSONRPCRequestV_SSSgtYaKF"
  },
  "title" : "send(_:path:)"
}
-->

# send(_:path:)

Sends a JSON-RPC request directly to the in-process `bitcoin_rpc()` C bridge.

```
func send(_ request: JSONRPCRequest, path: String?) async throws -> Data
```

## Discussion

`bitcoin_rpc()` is synchronous and may block indefinitely waiting for
internal locks (e.g. `cs_main` during initial block download). To honor
Swift concurrency’s forward-progress contract, the blocking call is
dispatched to a GCD thread and bridged back via a checked continuation.

If the call does not complete within [`timeout`](/documentation/Bitcoin/DirectTransport/timeout) seconds, the
continuation resumes with a timeout error. The underlying C call
continues on its GCD thread — its memory is freed when it returns.

Wallet-scoped calls (non-nil `path`) are not supported over the direct
transport and throw [`RPCClientError.walletPathNotSupported`](/documentation/Bitcoin/RPCClientError/walletPathNotSupported).