Skip to content

Commit

Permalink
src: webpage: src: Fix WebSocket breaking in higher frequencies
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoantoniocardoso committed Nov 4, 2024
1 parent 8ac5e20 commit 064eb08
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/webpage/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,16 @@ impl App {
"ws:"
};

let options = ewebsock::Options {
// Setting higher to avoid broken pipes at higher frequencies. The default is 10ms.
delay_blocking: std::time::Duration::from_millis(100),
..Default::default()
};

let url = format!("{protocol}//{host}/rest/ws");
let (mavlink_sender, mavlink_receiver) = {
let url = Url::parse(&url).unwrap().to_string();
connect(url, ewebsock::Options::default()).expect("Can't connect")
connect(url, options.clone()).expect("Can't connect")
};

set_stats_frequency(&self.stats_frequency.clone(), *self.stats_frequency.lock());
Expand Down

0 comments on commit 064eb08

Please sign in to comment.