chore: update documentation

This commit is contained in:
Lucas Nogueira
2026-09-22 11:30:47 -03:00
parent d869c162a7
commit a87a3c7d44
104 changed files with 4875 additions and 222 deletions
+9
View File
@@ -274,27 +274,36 @@ async fn send(
}
}
/// Initializes the plugin with the default [`Builder`], i.e. without a custom TLS [`Connector`].
pub fn init<R: Runtime>() -> TauriPlugin<R> {
Builder::default().build()
}
/// Builder for the WebSocket plugin, used to configure a custom TLS [`Connector`] before calling [`Builder::build`].
#[derive(Default)]
pub struct Builder {
tls_connector: Option<Connector>,
}
impl Builder {
/// Creates a new [`Builder`] with no custom TLS [`Connector`] configured.
pub fn new() -> Self {
Self {
tls_connector: None,
}
}
/// Sets the TLS [`Connector`] used to establish `wss://` connections.
///
/// When this is not called (or is called with [`Connector::Plain`]) and a `rustls-tls` or
/// `rustls-tls-native-roots` feature is enabled, [`Builder::build`] installs `rustls`'s `ring`
/// crypto provider as the process default if none is installed yet.
pub fn tls_connector(mut self, connector: Connector) -> Self {
self.tls_connector.replace(connector);
self
}
/// Builds the plugin, registering the `connect` and `send` commands and the shared connection state.
pub fn build<R: Runtime>(self) -> TauriPlugin<R> {
PluginBuilder::new("websocket")
.invoke_handler(tauri::generate_handler![connect, send])