Skip to content

EspWebSocketClientConfig: reconnect_timeout_ms and network_timeout_ms are not passed to the C config #635

Description

@awalland

Bug description

The EspWebSocketClientConfig struct exposes reconnect_timeout_ms and network_timeout_ms as public fields, but the TryFrom implementation that converts the config to esp_websocket_client_config_t never assigns them to the C struct. They fall through to ..Default::default(), which zeroes them out, causing the C library to silently fall back to its 10-second defaults regardless of what the user sets.

  • Would you like to work on a fix? [y/n]

Yes, absolutely

To Reproduce

let config = EspWebSocketClientConfig {
      reconnect_timeout_ms: Duration::from_secs(5),
      network_timeout_ms: Duration::from_secs(30),
      ..Default::default()
  };

  // Both values are silently ignored - the C library always uses its 10s defaults
  let client = EspWebSocketClient::new(url, &config, timeout, callback)?;

Expected behavior

The client should use the values passed in by the user.

Environment

  • Crate (esp-idf-svc) version: 0.51.0
  • ESP-IDF branch or tag: v5.4
  • Target device (MCU): esp32c6
  • OS: Linux (openSUSE Tumbleweed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions