Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
fix connect_with_config() and friends so that initial connection also…
Browse files Browse the repository at this point in the history
… uses passed in config
  • Loading branch information
svenski123 committed Nov 7, 2023
1 parent 1840aee commit 46f7fdc
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion ethers-providers/src/rpc/transports/ws/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,25 @@ impl RequestManager {
Ok((backend, mpsc::unbounded(), Default::default()))
}

#[cfg(not(target_arch = "wasm32"))]
async fn connect_with_config_internal(
conn: ConnectionDetails,
config: WebSocketConfig,
) -> Result<
(
BackendDriver,
(mpsc::UnboundedSender<Instruction>, mpsc::UnboundedReceiver<Instruction>),
SharedChannelMap,
),
WsClientError,
> {
let (ws, backend) = WsBackend::connect_with_config(conn, config, false).await?;

ws.spawn();

Ok((backend, mpsc::unbounded(), Default::default()))
}

#[cfg(target_arch = "wasm32")]
pub async fn connect_with_reconnects(
conn: ConnectionDetails,
Expand Down Expand Up @@ -291,7 +310,7 @@ impl RequestManager {
reconnects: usize,
) -> Result<(Self, WsClient), WsClientError> {
let (backend, (instructions_tx, instructions_rx), channel_map) =
Self::connect_internal(conn.clone()).await?;
Self::connect_with_config_internal(conn.clone(), config.clone()).await?;

Ok((
Self {
Expand Down

0 comments on commit 46f7fdc

Please sign in to comment.