WebCFace 2.5.2
Web-based Communication Framework & Dashboard-like UI
Loading...
Searching...
No Matches
server_ws.h
Go to the documentation of this file.
1#pragma once
2#ifdef WEBCFACE_MESON
3#include "webcface-config.h"
4#else
5#include "webcface/common/webcface-config.h"
6#endif
7#include <cstdint>
8#include <functional>
9#include <string>
10
12namespace server {
13using wsConnPtr = void *;
14
15using LoggerCallback = std::function<void(const char *, std::size_t, int)>;
16using OpenCallback = std::function<void(void *, const char *)>;
17using CloseCallback = std::function<void(void *, const char *)>;
18using MessageCallback = std::function<void(void *, const char *, std::size_t)>;
19
21 void *app = nullptr;
22 std::string exception_str;
23
24 void setException(const char *what) noexcept;
25
26 public:
27 AppWrapper(const LoggerCallback &callback, const char *static_dir,
28 std::uint16_t port, const char *unix_path,
29 const OpenCallback &on_open, const CloseCallback &on_close,
30 const MessageCallback &on_message) noexcept;
31 ~AppWrapper() noexcept;
32 static void send(wsConnPtr conn, const char *msg,
33 std::size_t size) noexcept;
34 static void close(wsConnPtr conn) noexcept;
35 void stop() noexcept;
36 void run() noexcept;
37 const char *exception() noexcept;
38};
39} // namespace server
Definition server_ws.h:20
std::function< void(void *, const char *, std::size_t)> MessageCallback
Definition server_ws.h:18
std::function< void(void *, const char *)> CloseCallback
Definition server_ws.h:17
void * wsConnPtr
Definition server.h:21
std::function< void(void *, const char *)> OpenCallback
Definition server_ws.h:16
std::function< void(const char *, std::size_t, int)> LoggerCallback
Definition server_ws.h:15
#define WEBCFACE_NS_END
Definition webcface-config.h:104
#define WEBCFACE_NS_BEGIN
Definition webcface-config.h:103