esp-protocols icon indicating copy to clipboard operation
esp-protocols copied to clipboard

feat(websocket): interruptable wait timeout

Open erkia opened this issue 1 year ago • 0 comments

Currently, websocket automatic reconnect delay is implemented using simple vTaskDelay(client->wait_timeout_ms / 2 / portTICK_PERIOD_MS). This has two drawbacks:

  • changing wait timeout while delay is already active has an unpredictable result
  • calling esp_websocket_client_stop() while delay is active will block until (half) reconnect delay is passed, which is especially annoying when delay is long.

This pull requests uses task notifications to wake up websocket task from reconnect delay when necessary.

erkia avatar Jul 03 '24 12:07 erkia