We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 66eec26 commit 533037eCopy full SHA for 533037e
1 file changed
src/transport/mod.rs
@@ -102,16 +102,21 @@ impl DatabaseConnection {
102
let http = HttpStrategy::new(reqwest_client, turso_config.clone());
103
let mut websocket = WebSocketStrategy::new(turso_config.clone());
104
105
- websocket.connect().await?;
106
-
107
- if cfg!(debug_assertions) {
108
- println!("WebSocket connection established for {}", db_name);
109
- }
+ let connection = websocket.connect().await;
+ let strategy: ActiveStrategy = match connection {
+ Ok(_) => ActiveStrategy::Websocket,
+ Err(err) => {
+ if cfg!(debug_assertions) {
110
+ println!("WebSocket connection failed: {}", err);
111
+ }
112
+ ActiveStrategy::Http
113
114
+ };
115
116
Ok(Self {
117
http,
118
websocket,
- strategy: ActiveStrategy::Websocket,
119
+ strategy,
120
})
121
}
122
0 commit comments