CppCMS
Public Member Functions | Friends | List of all members
cppcms::rpc::json_call Class Reference

This class represents single call of json-rpc method. More...

#include <cppcms/rpc_json.h>

Inheritance diagram for cppcms::rpc::json_call:
booster::noncopyable

Public Member Functions

 ~json_call ()
 
std::string method ()
 
bool notification ()
 
json::array const & params ()
 
http::contextcontext ()
 
void return_result (json::value const &)
 
void return_error (json::value const &)
 

Friends

class json_rpc_server
 

Detailed Description

This class represents single call of json-rpc method.

It is used for handling asynchronous responses only. Similar API is provided in json_rpc_server class for synchronous methods.

Constructor & Destructor Documentation

cppcms::rpc::json_call::~json_call ( )

Destructor. Automatically deletes appropriate context as once it given to user it owns it.

Member Function Documentation

http::context& cppcms::rpc::json_call::context ( )

Get context associated with the call. This you may wait on events like async_on_peer_reset of http::context via this member.

std::string cppcms::rpc::json_call::method ( )

Get the name of method that was called

bool cppcms::rpc::json_call::notification ( )

Check if method call is notification only. You should not return a value.

Note: if you do not add restriction when binding json-rpc method on the role of the call you should always check this value. Otherwise trying to call return_result or return_error would throw.

json::array const& cppcms::rpc::json_call::params ( )

Get call parameters as json::array (vector of json::value)

void cppcms::rpc::json_call::return_error ( json::value const &  )

Complete method response with a error. Throws call_error if the method was called as notification

void cppcms::rpc::json_call::return_result ( json::value const &  )

Complete method response with a result. Throws call_error if the method was called as notification


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