pub(crate) fn derive_ws_rpc_url(
ws_rpc_url: Option<&str>,
engine_rpc_url: &str,
) -> Result<Url>Expand description
Returns the websocket RPC URL used for the persistence subscription.
Preference:
- If
ws_rpc_urlis provided, use it directly. - Otherwise, derive a WS RPC URL from
engine_rpc_url.
The persistence subscription endpoint (reth_subscribePersistedBlock) is exposed on
the regular RPC server (WS port, usually 8546), not on the engine API port (usually 8551).
Since we may only have the engine URL by default, we convert the scheme
(http→ws, https→wss) and force the port to 8546.