-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWebsocketClient.h
35 lines (30 loc) · 983 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
#ifdef _MSC_VER
#ifdef WEBSOCKETCLIENT_EXPORTS
#define WEBSOCKETCLIENT_API __declspec(dllexport)
#else
#define WEBSOCKETCLIENT_API __declspec(dllimport)
#endif
#else
#define WEBSOCKETCLIENT_API
#endif
#include <string>
class WEBSOCKETCLIENT_API WebsocketClient
{
public:
class Listener
{
public:
virtual void onConnected() = 0;
virtual void onLogged(int code) = 0;
virtual void onLoggedError(int code) = 0;
virtual void onOpened(const std::string &sdp) = 0;
virtual void onOpenedError(int code) = 0;
virtual void onDisconnected() = 0;
};
public:
virtual bool connect(std::string url, std::string room, std::string username, std::string token, Listener* listener) = 0;
virtual bool open(const std::string &sdp) = 0;
virtual bool trickle(const std::string &mid, int index, const std::string &candidate, bool last) = 0;
virtual bool disconnect(bool wait) = 0;
};
WEBSOCKETCLIENT_API WebsocketClient* createWebsocketClient();