Real ping (#32)

* close method change and fix code

* missing mutex

* wip

* renaming and fixes

* renaming, fixes

* added enablePong/disablePong, add tests

* added new test cases

* add 1 test case

* fix gcd name to greatestCommonDivisor

* move ping and ping timeout checks into socket poll, local var in test cases and indent fixes

* indent issue
This commit is contained in:
Kumamon38
2019-04-18 18:24:16 +02:00
committed by Benjamin Sergeant
parent 65b11cb968
commit c3431f19bf
9 changed files with 850 additions and 78 deletions

View File

@ -33,6 +33,9 @@ namespace ix
virtual ~WebSocketServer();
virtual void stop() final;
void enablePong();
void disablePong();
void setOnConnectionCallback(const OnConnectionCallback& callback);
// Get all the connected clients
@ -41,6 +44,7 @@ namespace ix
private:
// Member variables
int _handshakeTimeoutSecs;
bool _enablePong;
OnConnectionCallback _onConnectionCallback;
@ -48,6 +52,7 @@ namespace ix
std::set<std::shared_ptr<WebSocket>> _clients;
const static int kDefaultHandShakeTimeoutSecs;
const static bool kDefaultEnablePong;
// Methods
virtual void handleConnection(int fd,