mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
Add websocket class
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <websocketpp/config/asio_no_tls.hpp>
|
||||
#include <websocketpp/server.hpp>
|
||||
|
||||
typedef websocketpp::server<websocketpp::config::asio> Server;
|
||||
|
||||
using websocketpp::lib::placeholders::_1;
|
||||
using websocketpp::lib::placeholders::_2;
|
||||
using websocketpp::lib::bind;
|
||||
|
||||
class Websocket
|
||||
{
|
||||
public:
|
||||
Websocket(uint16_t port, std::function<std::string(std::string)> on_message);
|
||||
void run();
|
||||
void stop();
|
||||
private:
|
||||
void on_message(Server* s, websocketpp::connection_hdl hdl, Server::message_ptr msg);
|
||||
Server server;
|
||||
std::function<std::string(std::string)> p_on_message;
|
||||
};
|
||||
Reference in New Issue
Block a user