diff --git a/plugins/websocket/src/lib.rs b/plugins/websocket/src/lib.rs index c3e08ace..1f06da32 100644 --- a/plugins/websocket/src/lib.rs +++ b/plugins/websocket/src/lib.rs @@ -79,15 +79,14 @@ enum WebSocketMessage { } #[tauri::command] -fn connect( +async fn connect( window: Window, url: String, callback_function: CallbackFn, config: Option, ) -> Result { let id = rand::random(); - let (ws_stream, _) = - tauri::async_runtime::block_on(connect_async_with_config(url, config.map(Into::into)))?; + let (ws_stream, _) = connect_async_with_config(url, config.map(Into::into)).await?; tauri::async_runtime::spawn(async move { let (write, read) = ws_stream.split();