how to use the keepAlivePeriod for clients ?
I'm trying to find a way to automatically ping all connected clients by using the native ping/pong feature (as workaround i could send custom messages from the client to the server)
I've set this in wsOnEvent:
if (type == WS_EVT_CONNECT)
{
// client connected
client->printf("Hello Client %u :)", client->id());
client->ping();
client->keepAlivePeriod(10);
}
else if (type == WS_EVT_PONG)
{
// pong message was received (in response to a ping request maybe)
Serial.printf("ws[%s][%u] pong[%u]: %s\n", server->url(), client->id(), len, (len) ? (char *)data : "");
}
and i'm expecting a ping/pong every 10 seconds, but nothing happens.
How should I enable the ping/pong ?
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
I have same issue. Trying to find a way to close web socket client when client IP address is not responding to pings (client disconnected). keepAlivePeriod seems to be perfect solution, but it doesn't work. Any other way to close web socket for client that doesn't respond to pings?
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.