"git@git.chaotikum.org:chaotikum/website.git" did not exist on "460fc78fb5df5b162c1afe9f155bda5506616063"
Newer
Older
/*
* connection_client.hpp
*
* Created on: 03.01.2021
* Author: doralitze
*/
#pragma once
#include <functional>
#include <memory>
#include <string>
namespace rmrf::net {
class connection_client : public std::enable_shared_from_this<connection_client> {
public:
typedef std::function<void(const std::string&)> incomming_data_cb;
connection_client() : in_data_cb{} {};
/**
* Use this method to send data to the other endpoint.
*/
virtual void write_data(const std::string& data) = 0;
/**
* Use this method in order to register your callback function that should be
* called when the client got data to process.
* @param cb The callback function to register [void(std::string data)]
*/
inline void set_incomming_data_callback(const incomming_data_cb &cb) {
this->in_data_cb = cb;
};