CppCMS
|
This class represents single call of json-rpc method. More...
#include <cppcms/rpc_json.h>
Public Member Functions | |
~json_call () | |
std::string | method () |
bool | notification () |
json::array const & | params () |
http::context & | context () |
void | return_result (json::value const &) |
void | return_error (json::value const &) |
Friends | |
class | json_rpc_server |
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.
Destructor. Automatically deletes appropriate context as once it given to user it owns it.
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