dioxus_liveview

Function interpreter_glue

Source
pub fn interpreter_glue(url_or_path: &str) -> String
Expand description

This script that gets injected into your app connects this page to the websocket endpoint

Once the endpoint is connected, it will send the initial state of the app, and then start processing user events and returning edits to the liveview instance.

You can pass a relative path prefixed with “/”, or enter a full URL including the protocol (ws: or wss:) as an argument.

If you enter a relative path, the web client automatically prefixes the host address in window.location when creating a web socket to LiveView.

use dioxus_liveview::interpreter_glue;

// Creates websocket connection to same host as current page
interpreter_glue("/api/liveview");

// Creates websocket connection to specified url
interpreter_glue("ws://localhost:8080/api/liveview");