-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathWebSocketClient.h
43 lines (28 loc) · 917 Bytes
/
WebSocketClient.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
42
43
//
// Created by alex on 10/9/17.
//
#ifndef LIVE5555_WEBSOCKETCLIENT_H
#define LIVE5555_WEBSOCKETCLIENT_H
#include <pthread.h>
#include <websocketpp/config/asio_no_tls_client.hpp>
#include <websocketpp/client.hpp>
typedef websocketpp::client<websocketpp::config::asio_client> WebSocketppClient;
typedef websocketpp::connection_hdl WebSocketppConnHdl;
class WebSocketClient {
private:
char *url;
pthread_t wsThread;
WebSocketppClient *wsppClient;
WebSocketppConnHdl wsppConnHdl;
public:
WebSocketClient( char *url );
char *getUrl() const;
virtual void connect();
virtual void sendBytes( unsigned char *buf, unsigned size );
virtual void sendText( char *text );
virtual ~WebSocketClient();
pthread_t getWsThread() const;
WebSocketppClient *getWsppClient();
void setWsppConnHdl( WebSocketppConnHdl wsppConnHdl );
};
#endif //LIVE5555_WEBSOCKETCLIENT_H