-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMessageHandler.hpp
More file actions
28 lines (19 loc) · 805 Bytes
/
Copy pathMessageHandler.hpp
File metadata and controls
28 lines (19 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once
#include "testo_nn_server_protocol/Channel.hpp"
#include "js/Context.hpp"
#include <version_number/VersionNumber.hpp>
struct MessageHandler: js::ContextEnv {
MessageHandler(std::shared_ptr<Channel> channel_): channel(std::move(channel_)) {};
~MessageHandler() = default;
MessageHandler(const MessageHandler&) = delete;
MessageHandler& operator=(const MessageHandler&) = delete;
void run();
stb::Image<stb::RGBA> get_ref_image(const std::string& img_path) override;
private:
nlohmann::json handle_request(nlohmann::json& request);
nlohmann::json handle_handshake(nlohmann::json& request);
nlohmann::json handle_js_eval(nlohmann::json& request);
nlohmann::json handle_js_validate(nlohmann::json& request);
std::shared_ptr<Channel> channel;
VersionNumber client_version;
};