xrpld
Loading...
Searching...
No Matches
xrpl::test::WSClient Class Referenceabstract

#include <WSClient.h>

Inheritance diagram for xrpl::test::WSClient:
Collaboration diagram for xrpl::test::WSClient:

Public Member Functions

virtual std::optional< json::ValuegetMsg (std::chrono::milliseconds const &timeout=std::chrono::milliseconds{0})=0
 Retrieve a message.
virtual std::optional< json::ValuefindMsg (std::chrono::milliseconds const &timeout, std::function< bool(json::Value const &)> pred)=0
 Retrieve a message that meets the predicate criteria.
virtual json::Value invoke (std::string const &cmd, json::Value const &params={})=0
 Submit a command synchronously.
virtual unsigned version () const =0
 Get RPC 1.0 or RPC 2.0.
virtual void disconnect ()=0
 Close the client's connection to the server.

Detailed Description

Definition at line 18 of file WSClient.h.

Member Function Documentation

◆ getMsg()

virtual std::optional< json::Value > xrpl::test::WSClient::getMsg ( std::chrono::milliseconds const & timeout = std::chrono::milliseconds{0})
pure virtual

Retrieve a message.

Implemented in xrpl::test::WSClientImpl.

◆ findMsg()

virtual std::optional< json::Value > xrpl::test::WSClient::findMsg ( std::chrono::milliseconds const & timeout,
std::function< bool(json::Value const &)> pred )
pure virtual

Retrieve a message that meets the predicate criteria.

Implemented in xrpl::test::WSClientImpl.

◆ invoke()

virtual json::Value xrpl::test::AbstractClient::invoke ( std::string const & cmd,
json::Value const & params = {} )
pure virtualinherited

Submit a command synchronously.

The arguments to the function and the returned JSON are in a normalized format, the same whether the client is using the JSON-RPC over HTTP/S or WebSocket transport.

Parameters
cmdThe command to execute
paramsjson::Value of null or object type with zero or more key/value pairs.
Returns
The server response in normalized format.

Implemented in xrpl::test::JSONRPCClient, and xrpl::test::WSClientImpl.

◆ version()

virtual unsigned xrpl::test::AbstractClient::version ( ) const
nodiscardpure virtualinherited

Get RPC 1.0 or RPC 2.0.

Implemented in xrpl::test::JSONRPCClient, and xrpl::test::WSClientImpl.

◆ disconnect()

virtual void xrpl::test::AbstractClient::disconnect ( )
pure virtualinherited

Close the client's connection to the server.

Releases the connection the client holds against the server's per-port connection limit. After this call the client must not be used to invoke() again. Tests use this to deterministically free the slot rather than waiting for the server's idle timeout to drop it.

Implemented in xrpl::test::JSONRPCClient, and xrpl::test::WSClientImpl.