8 #include <unordered_set>
14 class QWebSocketServer;
16 class WSServer : public QObject {
20 WSServer(const std::string &host, int port);
22 void add_init_command(const std::string &cmd);
23 void set_connection_callback(const std::function<void(bool)> &callback);
24 void send_command(const std::string &cmd);
25 void change_port(int port);
28 void on_new_connection();
34 std::vector<std::string> init_commands;
35 std::function<void(bool)> connection_callback;
37 QWebSocketServer *ws_server;
38 std::unordered_set<QWebSocket *> clients;
41 #endif // !defined(_WS_SERVER_H)