2015-03-26 22:38:43 +00:00
|
|
|
#pragma once
|
|
|
|
|
#include <fc/rpc/api_connection.hpp>
|
|
|
|
|
#include <fc/rpc/state.hpp>
|
|
|
|
|
#include <fc/network/http/websocket.hpp>
|
|
|
|
|
#include <fc/io/json.hpp>
|
|
|
|
|
#include <fc/reflect/variant.hpp>
|
|
|
|
|
|
|
|
|
|
namespace fc { namespace rpc {
|
|
|
|
|
|
2015-03-27 20:29:33 +00:00
|
|
|
class websocket_api_connection : public api_connection
|
2015-03-26 22:38:43 +00:00
|
|
|
{
|
|
|
|
|
public:
|
2020-08-12 13:00:39 +00:00
|
|
|
websocket_api_connection(const std::shared_ptr<fc::http::websocket_connection> &c, uint32_t max_conversion_depth );
|
2015-06-30 19:28:12 +00:00
|
|
|
~websocket_api_connection();
|
|
|
|
|
|
|
|
|
|
virtual variant send_call(
|
|
|
|
|
api_id_type api_id,
|
|
|
|
|
string method_name,
|
|
|
|
|
variants args = variants() ) override;
|
|
|
|
|
virtual variant send_callback(
|
|
|
|
|
uint64_t callback_id,
|
|
|
|
|
variants args = variants() ) override;
|
|
|
|
|
virtual void send_notice(
|
|
|
|
|
uint64_t callback_id,
|
|
|
|
|
variants args = variants() ) override;
|
2015-04-01 14:25:57 +00:00
|
|
|
|
2015-03-26 22:38:43 +00:00
|
|
|
protected:
|
2015-06-30 19:28:12 +00:00
|
|
|
std::string on_message(
|
|
|
|
|
const std::string& message,
|
|
|
|
|
bool send_message = true );
|
2015-05-12 18:50:08 +00:00
|
|
|
|
2020-08-12 13:00:39 +00:00
|
|
|
std::shared_ptr<fc::http::websocket_connection> _connection;
|
2015-03-30 22:34:04 +00:00
|
|
|
fc::rpc::state _rpc_state;
|
2015-03-26 22:38:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} } // namespace fc::rpc
|