Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.

public interface RpcTransport

Known subtypesNetworkTransport

The one HTTP exchange every chain client needs: send a body, read the reply. The clients in this package are written against this interface alone, so the same EvmRpc, EsploraClient and SolanaRpc run in an application and on the backend:

  • in an application, NetworkTransport sends through the NetworkManager;
  • on the backend, com.codename1.backend.WebRpcTransport sends through its WebClient.

A test passes its own implementation that answers recorded replies.

Every call blocks until the reply arrives. On the EDT the application transport waits with invokeAndBlock, as NetworkManager.addToQueueAndWait does, so the UI keeps painting.

Methods

public abstract String send(String method, String url, String contentType, String body) throws IOExceptionSends one request and answers the response body.

Method details

send

public abstract String send(String method, String url, String contentType, String body) throws IOException
Sends one request and answers the response body.

Parameters

method String
GET or POST
url String
the full URL
contentType String
the body’s media type, or null for a request without one
body String
the body, or null

Throws

RpcException
for a status outside 2xx, with the status and the body the server sent
IOException
when the request could not be made at all