MoleQueue  0.8.0
 All Classes Functions Variables Enumerations Enumerator Pages
Signals | Public Member Functions | List of all members
JsonRpc Class Reference

#include <molequeue/servercore/jsonrpc.h>

Inheritance diagram for JsonRpc:

Signals

void messageReceived (const MoleQueue::Message &message)
 

Public Member Functions

 JsonRpc (QObject *parent_=0)
 
void addConnectionListener (MoleQueue::ConnectionListener *connlist)
 
void removeConnectionListener (MoleQueue::ConnectionListener *connlist)
 

Detailed Description

The JsonRpc class manages ConnectionListener and Connection instances, and emits incoming JSON-RPC Messages.

Author
David C. Lonie

To use the JsonRpc class, create one or more ConnectionListener instances and call addConnectionListener(). Connect a slot to messageReceived and handle any incoming messages.

This class will handle the following standard JSON-RPC errors:

The remaining standard JSON-RPC error codes should be handled by the application developer when messageReceived:

Incoming requests with method="internalPing" will be automatically replied to with result="pong". This can be used to test if a server is alive or not. messageReceived will not be emitted in this case.

Use Message::generateResponse() and Message::generateErrorResponse() to easily create replies to incoming requests.

Member Function Documentation

void addConnectionListener ( MoleQueue::ConnectionListener connlist)

Register a connection listener with this JsonRpc instance. Any incoming connections on the listener will be monitored by this class and all incoming messages will be treated as JSON-RPC transmissions. This class does not take ownership of the listener, and will automatically remove it from any internal data structures if it is destroyed.

void removeConnectionListener ( MoleQueue::ConnectionListener connlist)

Unregister a connection listener from this JsonRpc instance. Any connections owned by this listener will be unregistered as well.

Parameters
connlist
void messageReceived ( const MoleQueue::Message message)
signal

Emitted when a valid message is received.


The documentation for this class was generated from the following file: