Loading...
Searching...
No Matches
JsonRpcClient Class Reference

`#include <avogadro/rpc/jsonrpcclient.h>`

Inheritance diagram for JsonRpcClient:

## Public Slots

bool | connectToServer (const QString &serverName)
void | flush ()
QJsonObject | emptyRequest ()
bool | sendRequest (const QJsonObject &request)

## Signals

void | connectionStateChanged ()
void | resultReceived (QJsonObject message)
void | notificationReceived (QJsonObject message)
void | errorReceived (QJsonObject message)
void | badPacketReceived (QString error)
void | newPacket (const QByteArray &packet)

## Public Member Functions

| JsonRpcClient (QObject *parent_=nullptr)
bool | isConnected () const
QString | serverName () const

## Protected Slots

void | readPacket (const QByteArray message)
void | readSocket ()

## Protected Attributes

unsigned int | m_packetCounter
QLocalSocket * | m_socket

## Detailed Description

The JsonRpcClient class is used by clients to submit calls to an RPC server using JSON-RPC 2.0.

Provides a simple Qt C++ API to make JSON-RPC 2.0 calls to an RPC server.

## Member Function Documentation

## isConnected()

bool isConnected | ( |  | ) | const

Query if the client is connected to a server.

## serverName()

QString serverName | ( |  | ) | const

Returns
  The server name that the client is connected to.

## connectToServer

bool connectToServer | ( | const QString & | serverName | ) |

slot

Connect to the server.

## flush

void flush | ( |  | ) |

slot

Flush all pending messages to the server.

## emptyRequest

QJsonObject emptyRequest | ( |  | ) |

slot

Construct an empty JSON-RPC 2.0 request with a valid request id.

## sendRequest

bool sendRequest | ( | const QJsonObject & | request | ) |

slot

Send the Json request to the RPC server.