pub struct PluginState<R: Runtime> { /* private fields */ }Expand description
Shared state for the conduit Tauri plugin.
Holds the router, named streaming channels, the per-launch invoke key, and the app handle for emitting push notifications.
Implementations§
Source§impl<R: Runtime> PluginState<R>
impl<R: Runtime> PluginState<R>
Sourcepub fn channel(&self, name: &str) -> Option<&Arc<ChannelBuffer>>
pub fn channel(&self, name: &str) -> Option<&Arc<ChannelBuffer>>
Get a channel by name (for pushing data from Rust handlers).
Sourcepub fn push(&self, channel: &str, data: &[u8]) -> Result<(), String>
pub fn push(&self, channel: &str, data: &[u8]) -> Result<(), String>
Push binary data to a named channel and notify JS listeners.
After writing to the channel, emits both a global
conduit:data-available event (payload = channel name) and a
per-channel conduit:data-available:{channel} event. JS subscribers
can listen on either.
For lossy channels, oldest frames are silently dropped when the buffer is full. For reliable channels, returns an error if the buffer is full (backpressure).
Returns an error string if the named channel was not registered via the builder or if a reliable channel is full.
Sourcepub fn channel_names(&self) -> Vec<String>
pub fn channel_names(&self) -> Vec<String>
Return the list of registered channel names.