|
|
@ -79,15 +79,14 @@ enum WebSocketMessage {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[tauri::command]
|
|
|
|
#[tauri::command]
|
|
|
|
fn connect<R: Runtime>(
|
|
|
|
async fn connect<R: Runtime>(
|
|
|
|
window: Window<R>,
|
|
|
|
window: Window<R>,
|
|
|
|
url: String,
|
|
|
|
url: String,
|
|
|
|
callback_function: CallbackFn,
|
|
|
|
callback_function: CallbackFn,
|
|
|
|
config: Option<ConnectionConfig>,
|
|
|
|
config: Option<ConnectionConfig>,
|
|
|
|
) -> Result<Id> {
|
|
|
|
) -> Result<Id> {
|
|
|
|
let id = rand::random();
|
|
|
|
let id = rand::random();
|
|
|
|
let (ws_stream, _) =
|
|
|
|
let (ws_stream, _) = connect_async_with_config(url, config.map(Into::into)).await?;
|
|
|
|
tauri::async_runtime::block_on(connect_async_with_config(url, config.map(Into::into)))?;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tauri::async_runtime::spawn(async move {
|
|
|
|
tauri::async_runtime::spawn(async move {
|
|
|
|
let (write, read) = ws_stream.split();
|
|
|
|
let (write, read) = ws_stream.split();
|
|
|
|