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:
		
				
					committed by
					
						
						Benjamin Sergeant
					
				
			
			
				
	
			
			
			
						parent
						
							65b11cb968
						
					
				
				
					commit
					c3431f19bf
				
			@@ -89,8 +89,12 @@ namespace ix
 | 
			
		||||
        void setUrl(const std::string& url);
 | 
			
		||||
        void setPerMessageDeflateOptions(const WebSocketPerMessageDeflateOptions& perMessageDeflateOptions);
 | 
			
		||||
        void setHandshakeTimeout(int handshakeTimeoutSecs);
 | 
			
		||||
        void setHeartBeatPeriod(int heartBeatPeriod);
 | 
			
		||||
 | 
			
		||||
        void setHeartBeatPeriod(int heartBeatPeriodSecs);
 | 
			
		||||
        void setPingInterval(int pingIntervalSecs); // alias of setHeartBeatPeriod
 | 
			
		||||
        void setPingTimeout(int pingTimeoutSecs);
 | 
			
		||||
        void enablePong();
 | 
			
		||||
        void disablePong();
 | 
			
		||||
        
 | 
			
		||||
        // Run asynchronously, by calling start and stop.
 | 
			
		||||
        void start();
 | 
			
		||||
        void stop();
 | 
			
		||||
@@ -114,6 +118,8 @@ namespace ix
 | 
			
		||||
        const std::string& getUrl() const;
 | 
			
		||||
        const WebSocketPerMessageDeflateOptions& getPerMessageDeflateOptions() const;
 | 
			
		||||
        int getHeartBeatPeriod() const;
 | 
			
		||||
        int getPingInterval() const;
 | 
			
		||||
        int getPingTimeout() const;
 | 
			
		||||
        size_t bufferedAmount() const;
 | 
			
		||||
 | 
			
		||||
        void enableAutomaticReconnection();
 | 
			
		||||
@@ -152,9 +158,15 @@ namespace ix
 | 
			
		||||
        std::atomic<int> _handshakeTimeoutSecs;
 | 
			
		||||
        static const int kDefaultHandShakeTimeoutSecs;
 | 
			
		||||
 | 
			
		||||
        // Optional Heartbeat
 | 
			
		||||
        int _heartBeatPeriod;
 | 
			
		||||
        static const int kDefaultHeartBeatPeriod;
 | 
			
		||||
        // enable or disable PONG frame response to received PING frame
 | 
			
		||||
        bool _enablePong;
 | 
			
		||||
        static const bool kDefaultEnablePong;
 | 
			
		||||
 | 
			
		||||
        // Optional ping and ping timeout
 | 
			
		||||
        int _pingIntervalSecs;
 | 
			
		||||
        int _pingTimeoutSecs;
 | 
			
		||||
        static const int kDefaultPingIntervalSecs;
 | 
			
		||||
        static const int kDefaultPingTimeoutSecs;
 | 
			
		||||
 | 
			
		||||
        friend class WebSocketServer;
 | 
			
		||||
    };
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user