pub struct Options { /* private fields */ }Expand description
How a host serves: what it hands a browser, and who it will talk to.
Built by chaining, and every field has a default that works, so a host only names what it cares about.
use rs_teststand_websocket::Options;
let options = Options::default()
.page(include_str!("../../examples/panel.html"))
.allow_origin("http://192.0.2.10:50751");Implementations§
Source§impl Options
impl Options
Sourcepub fn page(self, html: impl Into<String>) -> Self
pub fn page(self, html: impl Into<String>) -> Self
Serves html to a browser that asks for the root.
One address for the panel and the socket, so opening the host’s address
is the whole setup. It also gives them the same origin, which is what
lets the host trust its own panel without being told an address it picks
at bind time. A page loaded from disk instead has an origin of null
and gets no such trust.
Sourcepub fn allow_origin(self, origin: impl Into<String>) -> Self
pub fn allow_origin(self, origin: impl Into<String>) -> Self
Allows origin to open a socket.
Written the way a browser sends it, scheme and authority with no
trailing slash, such as http://192.0.2.10:50751. Matching is exact.
Needed only for a panel the host does not serve itself, since a page it serves already shares its origin and a native client sends no origin at all. Call it more than once to allow several.