INNER CODE UNIT · Rust

call

keon/browser-control · src/cdp.rs:68

    pub async fn call(&mut self, method: &str, params: Value, attach: bool) -> Result<Value> {
        if attach && self.session.is_none() {
            self.attach_page(None).await?
        }
        let s = attach.then(|| self.session.as_ref().unwrap().clone());
        self.send(method, params, s).await
    }

    pub async fn send(
        &mut self,
        method: &str,
        params: Value,
        session: Option<String>,
    ) -> Result<Value> {
        self.id += 1;
        let mut req = json!({"id":self.id,"method":method,"params":params});
        if let Some(s) = session {
            req["sessionId"] = json!(s)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…