cleanup / use a websocket instead of raw websockettransport

This commit is contained in:
Benjamin Sergeant
2018-12-30 22:00:49 -08:00
parent 266cf93584
commit 379a845166
6 changed files with 116 additions and 97 deletions

View File

@ -15,16 +15,22 @@ namespace ix
{
class WebSocketServer {
public:
WebSocketServer(int port = 8080);
WebSocketServer(int port = 8080, int backlog = 5);
virtual ~WebSocketServer();
std::pair<bool, std::string> run();
void handleConnection(int fd);
std::pair<bool, std::string> listen();
void run();
private:
int _port;
void handleConnection(int fd);
int _port;
int _backlog;
// socket for accepting connections
int _serverFd;
// FIXME: we never reclaim space in this array ...
std::vector<std::thread> _workers;
};
}