83 std::move(on_received), std::move(on_sent), std::move(on_closed));
94 template <
typename... Parameters>
98 method_name, message_id, parameters...));
108 template <
typename T>
113 request_id, result));
123 template <
typename T>
137 template <
typename... Parameters>
142 method_name, parameters...));
173 [[nodiscard]] std::shared_ptr<IConnection>
connection() const noexcept {
static SerializedMessage serialize_error_response(MessageID request_id, const T &error)
Serialize an error response.
static SerializedMessage serialize_notification(MethodNameView method_name, const Parameters &... parameters)
Serialize a notification.
static SerializedMessage serialize_successful_response(MessageID request_id, const T &result)
Serialize a successful response.
static SerializedMessage serialize_request(MethodNameView method_name, MessageID message_id, const Parameters &... parameters)
Serialize a request.
const addresses::IAddress & local_address() const noexcept
Get the address of the local endpoint.
IConnection::MessageReceivedCallback MessageReceivedCallback
Type of callback functions called when a message is received.
IConnection::ConnectionClosedCallback ConnectionClosedCallback
Type of callback functions called when a connection is closed.
void async_close()
Asynchronously close this connection.
std::shared_ptr< IConnection > connection() const noexcept
Get the IConnection object of this wrapper.
ConnectionWrapper(std::shared_ptr< IConnection > connection) noexcept
Constructor.
void async_request(messages::MethodNameView method_name, messages::MessageID message_id, const Parameters &... parameters)
Asynchronously send a request.
void async_response_error(messages::MessageID request_id, const T &error)
Asynchronously send a response with an error.
std::shared_ptr< IConnection > connection_
Connection.
void async_response_success(messages::MessageID request_id, const T &result)
Asynchronously send a response without an error.
void async_notify(messages::MethodNameView method_name, const Parameters &... parameters)
Asynchronously send a notification.
void start(MessageReceivedCallback on_received, MessageSentCallback on_sent, ConnectionClosedCallback on_closed)
Start process of this connection.
IConnection::MessageSentCallback MessageSentCallback
Type of callback functions called when a message is successfully sent.
const addresses::IAddress & remote_address() const noexcept
Get the address of the remote endpoint.
std::function< void(messages::ParsedMessage)> MessageReceivedCallback
Type of callback functions called when a message is received.
std::function< void(const Status &)> ConnectionClosedCallback
Type of callback functions called when a connection is closed.
std::function< void()> MessageSentCallback
Type of callback functions called when a message is successfully sent.
Definition of IConnection class.
Definition of MessageID type.
Definition of MessageSerializer class.
Definition of MethodNameView class.
std::uint32_t MessageID
Type of message IDs.
Namespace of transport of messages.