-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWebsocketClientImpl.h
41 lines (32 loc) · 1.21 KB
/
WebsocketClientImpl.h
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
31
32
33
34
35
36
37
38
39
40
41
#include "WebsocketClient.h"
//Use http://think-async.com/ insted of boost
#define ASIO_STANDALONE
#define _WEBSOCKETPP_CPP11_STL_
#define _WEBSOCKETPP_CPP11_THREAD_
#define _WEBSOCKETPP_CPP11_FUNCTIONAL_
#define _WEBSOCKETPP_CPP11_SYSTEM_ERROR_
#define _WEBSOCKETPP_CPP11_RANDOM_DEVICE_
#define _WEBSOCKETPP_CPP11_MEMORY_
#include "websocketpp/config/asio_client.hpp"
#include "websocketpp/client.hpp"
typedef websocketpp::client<websocketpp::config::asio_tls_client> Client;
class WebsocketClientImpl : public WebsocketClient
{
public:
WebsocketClientImpl();
~WebsocketClientImpl();
virtual bool connect(std::string url, std::string room, std::string username, std::string token, WebsocketClient::Listener* listener);
virtual bool open(const std::string &sdp);
virtual bool trickle(const std::string &mid, int index, const std::string &candidate, bool last);
virtual bool disconnect(bool wait);
private:
bool logged;
__int64 session_id;
__int64 handle_id;
std::atomic<bool> is_running;
std::future<void> handle;
std::thread thread;
std::thread thread_keepAlive;
Client client;
Client::connection_ptr connection;
};