conditional websocket url
This commit is contained in:
parent
78d6486822
commit
bd5a3846ef
1 changed files with 10 additions and 1 deletions
|
@ -38,6 +38,14 @@ impl WebSocketContext {
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Websocket() -> impl IntoView {
|
pub fn Websocket() -> impl IntoView {
|
||||||
|
let url;
|
||||||
|
|
||||||
|
if cfg!(debug_assertions) {
|
||||||
|
url = "ws://127.0.0.1:3030/websocket";
|
||||||
|
} else {
|
||||||
|
url = "wss://cards.doordesk.net/websocket";
|
||||||
|
}
|
||||||
|
|
||||||
let UseWebSocketReturn {
|
let UseWebSocketReturn {
|
||||||
ready_state,
|
ready_state,
|
||||||
message,
|
message,
|
||||||
|
@ -45,7 +53,8 @@ pub fn Websocket() -> impl IntoView {
|
||||||
open,
|
open,
|
||||||
close,
|
close,
|
||||||
..
|
..
|
||||||
} = use_websocket::<String, FromToStringCodec>("wss://cards.doordesk.net/websocket");
|
// } = use_websocket::<String, FromToStringCodec>("wss://cards.doordesk.net/websocket");
|
||||||
|
} = use_websocket::<String, FromToStringCodec>(url);
|
||||||
|
|
||||||
provide_context(WebSocketContext::new(
|
provide_context(WebSocketContext::new(
|
||||||
ready_state,
|
ready_state,
|
||||||
|
|
Loading…
Add table
Reference in a new issue