Skip to main content

parse_socket_url_response

Function parse_socket_url_response 

Source
pub fn parse_socket_url_response(resp: &Value) -> Result<String, String>
Expand description

Resolve the WebSocket URL out of an apps.connections.open response body. Pure function so the reconnect-spin guard is unit-testable without a live HTTP call: an ok:false body, or an ok:true body whose url is absent/empty, both yield Err (NOT Ok("")). Returning Ok("") would route through the success arm of RealSlackTransport::spawn_socket_loop (resetting backoff), then connect_async("") fails instantly — a tight, no-sleep open→fail→open spin. Routing it as Err sends it through the backoff/sleep arm instead.