Enhance WebSocket server ping/pong handling and timeout settings
- Introduce handling for LWS_CALLBACK_RECEIVE_PONG to manage Pong frames received from clients. - Update the WebSocketUserData structure to increase MAX_PING_TIMEOUTS from 3 to 5, allowing more attempts before disconnection. - Extend PONG_TIMEOUT_SECONDS from 10 to 60 to accommodate longer response times from browsers. - Modify ping handling to send a WebSocket Ping frame instead of a text message for better protocol compliance.
This commit is contained in:
committed by
Torsten (PC)
parent
0eb3a78332
commit
e3f46d775a
@@ -25,9 +25,9 @@ struct WebSocketUserData {
|
||||
std::chrono::steady_clock::time_point lastPingTime;
|
||||
std::chrono::steady_clock::time_point lastPongTime;
|
||||
int pingTimeoutCount = 0;
|
||||
static constexpr int MAX_PING_TIMEOUTS = 3;
|
||||
static constexpr int MAX_PING_TIMEOUTS = 5; // Mehr Versuche bevor Trennung
|
||||
static constexpr int PING_INTERVAL_SECONDS = 30;
|
||||
static constexpr int PONG_TIMEOUT_SECONDS = 10;
|
||||
static constexpr int PONG_TIMEOUT_SECONDS = 60; // Längeres Timeout (Browser können länger brauchen)
|
||||
};
|
||||
|
||||
class Worker; // forward
|
||||
|
||||
Reference in New Issue
Block a user