mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-21 09:14:34 +00:00
make net ws more robust to test websocket server connection failure
This commit is contained in:
parent
fe2eb732a0
commit
7a75bf73e3
1 changed files with 15 additions and 9 deletions
|
|
@ -415,9 +415,9 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
|||
#[cfg(feature = "websocket")]
|
||||
"ws" => {
|
||||
if self.ws.is_none() {
|
||||
let (socket, response) =
|
||||
tungstenite::connect(url::Url::parse("wss://awake.noskills.club/ws").unwrap()).expect("Can't connect");
|
||||
|
||||
let url = url::Url::parse("wss://awake.noskills.club/ws").expect("Can't parse");
|
||||
match tungstenite::connect(url) {
|
||||
Ok((socket, response)) => {
|
||||
log::info!("Connected to the server");
|
||||
log::info!("Response HTTP code: {}", response.status());
|
||||
log::info!("Response contains the following headers:");
|
||||
|
|
@ -426,6 +426,12 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
|||
}
|
||||
self.ws = Some(socket);
|
||||
}
|
||||
Err(e) => {
|
||||
log::warn!("failed to connect to ws server: {e}");
|
||||
write!(ret, "failed to connect to ws server: {e}").ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut err = false;
|
||||
if let Some(socket) = &mut self.ws {
|
||||
let mut val = String::<1024>::new();
|
||||
|
|
|
|||
Loading…
Reference in a new issue