pub struct CdpConnection { /* private fields */ }Expand description
The single shared CDP connection over one WebSocket.
Cheap to share via Arc<CdpConnection>. A background dispatch task runs
until the socket closes; when it does, all pending callbacks resolve to
Error::ChannelClosed.
Implementations§
Source§impl CdpConnection
impl CdpConnection
Sourcepub async fn connect(
ws_url: &str,
headers: Option<HashMap<String, String>>,
) -> Result<(Arc<Self>, Receiver<CdpEvent>)>
pub async fn connect( ws_url: &str, headers: Option<HashMap<String, String>>, ) -> Result<(Arc<Self>, Receiver<CdpEvent>)>
Connect to a CDP WebSocket endpoint and start the dispatch task.
Returns the shared connection plus a receiver for browser-level events
(session_id == None).
Sourcepub async fn send_command(
self: &Arc<Self>,
session_id: Option<&str>,
method: &str,
params: Value,
) -> Result<Value>
pub async fn send_command( self: &Arc<Self>, session_id: Option<&str>, method: &str, params: Value, ) -> Result<Value>
Send a CDP command and await its response (no timeout — wrap at a
higher layer if needed). session_id is None for browser-level.
Auto Trait Implementations§
impl !Freeze for CdpConnection
impl !RefUnwindSafe for CdpConnection
impl !UnwindSafe for CdpConnection
impl Send for CdpConnection
impl Sync for CdpConnection
impl Unpin for CdpConnection
impl UnsafeUnpin for CdpConnection
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