mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-01-23 09:09:21 -05:00
fixed use_websocket example
This commit is contained in:
parent
938028c99d
commit
5c79bf349e
1 changed files with 4 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_use::docs::demo_or_body;
|
use leptos_use::docs::demo_or_body;
|
||||||
use leptos_use::{
|
use leptos_use::{
|
||||||
use_websocket, use_websocket_with_options, UseWebSocketOptions, ConnectionReadyState,
|
core::ConnectionReadyState, use_websocket, use_websocket_with_options, UseWebSocketOptions,
|
||||||
UseWebsocketReturn,
|
UseWebsocketReturn,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ fn Demo() -> impl IntoView {
|
||||||
open,
|
open,
|
||||||
close,
|
close,
|
||||||
..
|
..
|
||||||
} = use_websocket("wss://echo.websocket.events/".to_string());
|
} = use_websocket("wss://echo.websocket.events/");
|
||||||
|
|
||||||
let send_message = move |_| {
|
let send_message = move |_| {
|
||||||
let m = "Hello, world!".to_string();
|
let m = "Hello, world!".to_string();
|
||||||
|
@ -107,9 +107,9 @@ fn Demo() -> impl IntoView {
|
||||||
message_bytes: message_bytes2,
|
message_bytes: message_bytes2,
|
||||||
..
|
..
|
||||||
} = use_websocket_with_options(
|
} = use_websocket_with_options(
|
||||||
"wss://echo.websocket.events/".to_string(),
|
"wss://echo.websocket.events/",
|
||||||
UseWebSocketOptions::default()
|
UseWebSocketOptions::default()
|
||||||
.manual(true)
|
.immediate(false)
|
||||||
.on_open(on_open_callback.clone())
|
.on_open(on_open_callback.clone())
|
||||||
.on_close(on_close_callback.clone())
|
.on_close(on_close_callback.clone())
|
||||||
.on_error(on_error_callback.clone())
|
.on_error(on_error_callback.clone())
|
||||||
|
|
Loading…
Add table
Reference in a new issue