Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <Windows.h>
- #include <winhttp.h>
- #include <iostream>
- #include <nlohmann/json.hpp>
- #pragma comment(lib, "winhttp.lib")
- class WebSocketClient {
- using json = nlohmann::json;
- private:
- HINTERNET hSession = NULL;
- HINTERNET hConnect = NULL;
- HINTERNET hRequest = NULL;
- HANDLE hWebSocket = NULL;
- public:
- WebSocketClient();
- ~WebSocketClient();
- bool Connect(const wchar_t* host, int port, const wchar_t* path);
- bool Send(const json& j) const;
- std::string Receive() const;
- bool CheckConnection() const;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement