forked from awwit/httpserverapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebSocket.h
More file actions
30 lines (22 loc) · 779 Bytes
/
WebSocket.h
File metadata and controls
30 lines (22 loc) · 779 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
29
30
#pragma once
#include "../../socket/Adapter.h"
namespace HttpClient
{
class WebSocket
{
private:
Socket::Adapter *sock;
public:
static std::vector<char> packDataToMessageFrame(const void *data, const size_t size);
public:
WebSocket() = delete;
WebSocket(const WebSocket &obj) noexcept;
WebSocket(Socket::Adapter *adapter) noexcept;
Socket::Adapter *getSocket() noexcept;
const Socket::Adapter *getSocket() const noexcept;
long nonblock_recv(std::vector<char> &frame, const std::chrono::milliseconds &timeout) const;
long nonblock_send(const void *data, const size_t length, const std::chrono::milliseconds &timeout) const;
long nonblock_send(const std::string &str, const std::chrono::milliseconds &timeout) const;
void close() noexcept;
};
}