pub struct ChromeBridge { /* private fields */ }Expand description
The live connection registry. One instance per process (see bridge).
Transport integration (in roder-app-server::remote), on each connection:
ⓘ
// on first `hello` frame:
let reg = bridge().register_client(Some(remote_addr.clone()), &frame);
// spawn a task draining reg.commands -> websocket as Message::Text(JSON)
// for every inbound bridge frame: bridge().ingest_frame(Some(reg.client_id), frame);
// on disconnect: bridge().unregister_client(reg.client_id);Implementations§
Source§impl ChromeBridge
impl ChromeBridge
pub fn new() -> Self
Sourcepub fn register_client(
&self,
remote_addr: Option<String>,
hello: &Value,
) -> ChromeClientRegistration
pub fn register_client( &self, remote_addr: Option<String>, hello: &Value, ) -> ChromeClientRegistration
Register a newly-connected extension. Returns the receiver the transport must drain to deliver commands to that extension.
Sourcepub fn unregister_client(&self, client_id: u64)
pub fn unregister_client(&self, client_id: u64)
Remove a disconnected extension and fail any of its pending commands.
Sourcepub fn ingest_frame(&self, client_id: Option<u64>, frame: Value)
pub fn ingest_frame(&self, client_id: Option<u64>, frame: Value)
Route an inbound bridge frame from the extension: resolve a pending command result or fold an unsolicited event into bridge state.
Trait Implementations§
Source§impl ChromeController for ChromeBridge
impl ChromeController for ChromeBridge
Source§fn status(&self) -> ChromeStatus
fn status(&self) -> ChromeStatus
Current connection status.
Source§fn set_enabled(&self, enabled: bool)
fn set_enabled(&self, enabled: bool)
Enable/disable Chrome tools for the session.
Source§fn set_mode(&self, mode: ChromePermissionMode)
fn set_mode(&self, mode: ChromePermissionMode)
Set the permission mode.
Source§fn dispatch<'life0, 'async_trait>(
&'life0 self,
command: ChromeCommand,
) -> Pin<Box<dyn Future<Output = Result<Value, ChromeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn dispatch<'life0, 'async_trait>(
&'life0 self,
command: ChromeCommand,
) -> Pin<Box<dyn Future<Output = Result<Value, ChromeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Forward a command to the connected extension and await its result.
Source§fn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Whether Chrome tools are enabled for the session.
Auto Trait Implementations§
impl !Freeze for ChromeBridge
impl RefUnwindSafe for ChromeBridge
impl Send for ChromeBridge
impl Sync for ChromeBridge
impl Unpin for ChromeBridge
impl UnsafeUnpin for ChromeBridge
impl UnwindSafe for ChromeBridge
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more