mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Add ping and pong endpoint wrapper methods
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
HEAD
|
||||
- Add ping and pong endpoint wrapper methods
|
||||
- Add `get_request()` pass through method to connection to allow calling methods
|
||||
specific to the HTTP policy in use.
|
||||
- Fix issue compiling with `WEBSOCKETPP_STRICT_MASKING`
|
||||
|
||||
@@ -283,6 +283,48 @@ public:
|
||||
const std::string & reason, lib::error_code & ec);
|
||||
void close(connection_hdl hdl, const close::status::value code,
|
||||
const std::string & reason);
|
||||
|
||||
/// Send a ping to a specific connection
|
||||
/**
|
||||
* @since 0.3.0-alpha3
|
||||
*
|
||||
* @param [in] hdl The connection_hdl of the connection to send to.
|
||||
* @param [in] payload The payload string to send.
|
||||
* @param [out] ec A reference to an error code to fill in
|
||||
*/
|
||||
void ping(connection_hdl hdl, std::string const & payload,
|
||||
lib::error_code & ec);
|
||||
/// Send a ping to a specific connection
|
||||
/**
|
||||
* Exception variant of `ping`
|
||||
*
|
||||
* @since 0.3.0-alpha3
|
||||
*
|
||||
* @param [in] hdl The connection_hdl of the connection to send to.
|
||||
* @param [in] payload The payload string to send.
|
||||
*/
|
||||
void ping(connection_hdl hdl, std::string const & payload);
|
||||
|
||||
/// Send a pong to a specific connection
|
||||
/**
|
||||
* @since 0.3.0-alpha3
|
||||
*
|
||||
* @param [in] hdl The connection_hdl of the connection to send to.
|
||||
* @param [in] payload The payload string to send.
|
||||
* @param [out] ec A reference to an error code to fill in
|
||||
*/
|
||||
void pong(connection_hdl hdl, std::string const & payload,
|
||||
lib::error_code & ec);
|
||||
/// Send a pong to a specific connection
|
||||
/**
|
||||
* Exception variant of `pong`
|
||||
*
|
||||
* @since 0.3.0-alpha3
|
||||
*
|
||||
* @param [in] hdl The connection_hdl of the connection to send to.
|
||||
* @param [in] payload The payload string to send.
|
||||
*/
|
||||
void pong(connection_hdl hdl, std::string const & payload);
|
||||
|
||||
/// Retrieves a connection_ptr from a connection_hdl (exception free)
|
||||
/**
|
||||
|
||||
@@ -180,6 +180,42 @@ void endpoint<connection,config>::close(connection_hdl hdl,
|
||||
if (ec) { throw ec; }
|
||||
}
|
||||
|
||||
template <typename connection, typename config>
|
||||
void endpoint<connection,config>::ping(connection_hdl hdl, std::string const &
|
||||
payload, lib::error_code & ec)
|
||||
{
|
||||
connection_ptr con = get_con_from_hdl(hdl,ec);
|
||||
if (ec) {return;}
|
||||
con->ping(code,payload,ec);
|
||||
}
|
||||
|
||||
template <typename connection, typename config>
|
||||
void endpoint<connection,config>::ping(connection_hdl hdl, std::string const &
|
||||
payload)
|
||||
{
|
||||
lib::error_code ec;
|
||||
ping(hdl,code,payload,ec);
|
||||
if (ec) { throw ec; }
|
||||
}
|
||||
|
||||
template <typename connection, typename config>
|
||||
void endpoint<connection,config>::pong(connection_hdl hdl, std::string const &
|
||||
payload, lib::error_code & ec)
|
||||
{
|
||||
connection_ptr con = get_con_from_hdl(hdl,ec);
|
||||
if (ec) {return;}
|
||||
con->pong(code,payload,ec);
|
||||
}
|
||||
|
||||
template <typename connection, typename config>
|
||||
void endpoint<connection,config>::pong(connection_hdl hdl, std::string const &
|
||||
payload)
|
||||
{
|
||||
lib::error_code ec;
|
||||
pong(hdl,code,payload,ec);
|
||||
if (ec) { throw ec; }
|
||||
}
|
||||
|
||||
template <typename connection, typename config>
|
||||
void endpoint<connection,config>::remove_connection(connection_ptr con) {
|
||||
std::stringstream s;
|
||||
|
||||
Reference in New Issue
Block a user