esp-protocols
esp-protocols copied to clipboard
feat(websocket): interruptable wait timeout
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.