server code has a callback that takes a websocket

This commit is contained in:
Benjamin Sergeant committed 2018-12-30 22:12:13 -08:00
1 parent 379a845166
commit b2eb07db14
3 files changed
+43 -20

No files matched your search

+9
View File
@@ -10,14 +10,21 @@
#include <string>
#include <vector>
#include <thread>
#include <functional>
#include "IXWebSocket.h"
namespace ix
{
using OnConnectionCallback = std::function<void(WebSocket&)>;
class WebSocketServer {
public:
WebSocketServer(int port = 8080, int backlog = 5);
virtual ~WebSocketServer();
void setOnConnectionCallback(const OnConnectionCallback& callback);
std::pair<bool, std::string> listen();
void run();
@@ -27,6 +34,8 @@ namespace ix
int _port;
int _backlog;
OnConnectionCallback _onConnectionCallback;
// socket for accepting connections
int _serverFd;