Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix websocket reconnect limit #43

Merged
merged 2 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/yew-hooks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yew-hooks"
version = "0.3.1"
version = "0.3.2"
edition = "2021"
authors = ["Jet Li <jing.i.qin@icloud.com>"]
categories = ["gui", "wasm", "web-programming"]
Expand All @@ -17,7 +17,7 @@ documentation = "https://docs.rs/yew-hooks/"
[dependencies]
log = "0.4"
yew = { version = "0.21.0", features = ["csr"] }
gloo = "0.10"
gloo = "0.11"
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
serde = "1"
Expand Down
4 changes: 2 additions & 2 deletions crates/yew-hooks/src/hooks/use_websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct UseWebSocketOptions {
/// `WebSocket` close callback.
pub onclose: Option<Box<dyn FnMut(CloseEvent)>>,

/// Retry times. Defaults to 3, use `u32::MAX` for infinite retries.
/// Retry times. Defaults to `u32::MAX` for infinite retries.
pub reconnect_limit: Option<u32>,
/// Retry interval(ms). Defaults to 3000.
pub reconnect_interval: Option<u32>,
Expand Down Expand Up @@ -235,7 +235,7 @@ pub fn use_websocket_with_options(url: String, options: UseWebSocketOptions) ->
let onmessage_bytes_ref = use_mut_latest(options.onmessage_bytes);
let onerror_ref = use_mut_latest(options.onerror);
let onclose_ref = use_mut_latest(options.onclose);
let reconnect_limit = options.reconnect_limit.unwrap_or(3);
let reconnect_limit = options.reconnect_limit.unwrap_or(u32::MAX);
let reconnect_interval = options.reconnect_interval.unwrap_or(3 * 1000);
let manual = options.manual.unwrap_or(false);
let protocols = options.protocols;
Expand Down
1 change: 1 addition & 0 deletions crates/yew-hooks/src/web_sys_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//! which is inconvenient, so copy the binding code here for now.
#![allow(unused_imports)]
#![allow(clippy::unused_unit)]
#![allow(clippy::empty_docs)]
use wasm_bindgen::{self, prelude::*};
use web_sys::{DataTransfer, DomRectReadOnly, Element, Event, EventTarget};

Expand Down
4 changes: 2 additions & 2 deletions examples/yew-app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ version = "0.1.0"

[dependencies]
log = "0.4"
gloo = "0.10"
gloo = "0.11"
js-sys = "0.3"
serde = "1"
reqwest = { version = "0.11.7", features = ["json"] }
reqwest = { version = "0.12.4", features = ["json"] }
yew = { version = "0.21.0", features = ["csr"] }
yew-router = { version = "0.18.0" }
yew-hooks = { path = "../../crates/yew-hooks" }
Expand Down
Loading