use html::Textarea;
use leptos::*;
use leptos_use::{core::ConnectionReadyState, use_websocket, UseWebsocketReturn};
#[component]
pub fn Websocket() -> impl IntoView {
let UseWebsocketReturn {
ready_state,
message,
send,
open,
close,
..
} = use_websocket("ws://0.0.0.0:3030/websocket");
let send_message = move |_| {
send("Hello, world!");
};
let status = move || ready_state.get().to_string();
let connected = move || ready_state.get() == ConnectionReadyState::Open;
let open_connection = move |_| {
open();
};
let close_connection = move |_| {
close();
};
let chat_history_ref = create_node_ref::