19 #ifndef IRCCD_DAEMON_TRANSPORT_CLIENT_HPP
20 #define IRCCD_DAEMON_TRANSPORT_CLIENT_HPP
27 #include <irccd/sysconfig.hpp>
31 #include <string_view>
33 #include <irccd/stream.hpp>
37 class transport_server;
63 std::weak_ptr<transport_server> parent_;
64 std::shared_ptr<stream> stream_;
65 std::deque<std::pair<nlohmann::json, stream::send_handler>> queue_;
80 std::shared_ptr<stream>
stream) noexcept;
131 void write(nlohmann::json json,
stream::send_handler handler =
nullptr);
140 void success(const
std::
string& command,
stream::send_handler handler =
nullptr);
150 void error(
std::error_code code,
stream::send_handler handler =
nullptr);
161 void error(
std::error_code code,
std::string_view command,
stream::send_handler handler =
nullptr);
166 #endif // !IRCCD_DAEMON_TRANSPORT_CLIENT_HPP
Abstract transport client class.
Definition: transport_client.hpp:45
transport_client(std::weak_ptr< transport_server > server, std::shared_ptr< stream > stream) noexcept
@ authenticating
client is authenticating
void error(std::error_code code, stream::send_handler handler=nullptr)
void success(const std::string &command, stream::send_handler handler=nullptr)
void write(nlohmann::json json, stream::send_handler handler=nullptr)
Abstract stream interface.
Definition: stream.hpp:58
void set_state(state state) noexcept
void read(stream::recv_handler handler)
@ closing
client is closing
state
Definition: transport_client.hpp:55
Main irccd namespace.
Definition: bot.hpp:41
std::function< void(std::error_code)> handshake_handler
Definition: transport_client.hpp:50
auto get_state() const noexcept -> state
void handshake(handshake_handler)