pub struct CdpClient { /* private fields */ }Implementations§
Source§impl CdpClient
impl CdpClient
Sourcepub async fn connect(ws_url: &str) -> Result<CdpClient, Error>
pub async fn connect(ws_url: &str) -> Result<CdpClient, Error>
Connect to a raw CDP WebSocket URL (ws://…).
Sourcepub fn subscribe_events(&self) -> Receiver<CdpEvent>
pub fn subscribe_events(&self) -> Receiver<CdpEvent>
Subscribe to every CDP event. Caller filters by method / session_id.
Sourcepub fn subscribe_session_events(&self, session_id: &str) -> Receiver<CdpEvent>
pub fn subscribe_session_events(&self, session_id: &str) -> Receiver<CdpEvent>
Subscribe to events scoped to a specific session_id. Events for other
sessions are discarded by a filter task to keep the receiver simple.
Sourcepub async fn discover_ws_url(
http_url: &str,
timeout_ms: u64,
) -> Result<String, Error>
pub async fn discover_ws_url( http_url: &str, timeout_ms: u64, ) -> Result<String, Error>
Discover WS URL from a CDP HTTP endpoint (http://127.0.0.1:9222).
pub async fn send(&self, method: &str, params: Value) -> Result<Value, Error>
pub async fn send_with_session( &self, method: &str, params: Value, session_id: Option<String>, ) -> Result<Value, Error>
Sourcepub async fn send_with_timeout(
&self,
method: &str,
params: Value,
session_id: Option<String>,
timeout: Duration,
) -> Result<Value, Error>
pub async fn send_with_timeout( &self, method: &str, params: Value, session_id: Option<String>, timeout: Duration, ) -> Result<Value, Error>
Like send_with_session but with a caller-specified timeout.
Without an upper bound a CDP request waiting on a crashed tab
would hang forever — every other client in this workspace caps
its waits, so browser gets the same treatment.
pub fn close(&self)
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CdpClient
impl !UnwindSafe for CdpClient
impl Forget for CdpClient
impl Freeze for CdpClient
impl Move for CdpClient
impl Send for CdpClient
impl Sync for CdpClient
impl Unpin for CdpClient
impl UnsafeUnpin for CdpClient
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more