Skip to main content

browser_commander/puppeteer/api/
connection_transport.rs

1// @generated by scripts/generate-puppeteer-bindings.mjs from
2// rust/protocol/puppeteer/api.json. Do not edit by hand.
3
4#![allow(clippy::all, missing_docs, unused_imports, non_snake_case)]
5
6use serde_json::Value;
7
8use super::*;
9use crate::puppeteer::bridge::{binary, remote_type, BridgeError, JsFunction, Remote};
10
11remote_type!(
12    /// Puppeteer's `ConnectionTransport` (puppeteer-core 25.10.0), a remote object
13    /// served by `browser-commander serve --stdio`.
14    ConnectionTransport
15);
16
17impl ConnectionTransport {
18    /// `ConnectionTransport.send`
19    ///
20    /// ```text
21    /// send(message: string): void
22    /// ```
23    pub async fn send(&self, message: &str) -> Result<(), BridgeError> {
24        self.remote.call("send", vec![Some(Value::from(message))]).await
25    }
26
27    /// `ConnectionTransport.close`
28    ///
29    /// ```text
30    /// close(): void
31    /// ```
32    pub async fn close(&self) -> Result<(), BridgeError> {
33        self.remote.call("close", vec![]).await
34    }
35}