cdp-lite
cdp-lite is a lightweight, asynchronous, and low-overhead Rust client for the Chrome DevTools Protocol (CDP).
Unlike heavier frameworks, cdp-lite focuses on providing a minimal and fast interface to interact with Chromium-based browsers via WebSockets. It is designed for developers who need raw control, high performance, and a small binary footprint.
⨠Features
- Zero Bloat: Minimal dependencies and no unnecessary abstractions.
- Fully Asynchronous: Built on top of
tokioandtungstenite. - Low Overhead: Efficient command/event dispatching using
oneshotandbroadcastchannels. - Direct Protocol Access: Send any CDP command and receive raw JSON responses.
- Event Filtering: Subscribe to specific protocol domains (Page, Network, Debugger, etc.) with ease.
đ Quick Start
Add this to your Cargo.toml:
[]
= "0.1.0"
= { = "1", = ["full"] }
= "1.0"
đšī¸ Basic Usage
use CdpResult;
use NoParams;
use Serialize;
use Duration;
async
đĄ Event Subscription
cdp-lite allows you to listen to specific protocol domains without overhead. You can spawn multiple listeners for different domains simultaneously:
// Create a stream for Network events
let mut network_events = client.on_domain;
spawn;
đ Why cdp-lite?
Most Rust libraries for Chrome are high-level wrappers that abstract the protocol. While useful, they can be restrictive for:
- Security Research: Precise control over frame interception and debugger state.
- High-Performance Scrapers: Minimizing CPU and memory usage per browser instance.
- Custom Tooling: Building specialized debugging or profiling tools.
cdp-lite stays out of your way and gives you the "wire" directly.
đ License
This project is licensed under the MIT License. It is free to use, modify, and distribute, even for commercial purposes. See the LICENSE file for more details.
đ¤ Contributing
Contributions are welcome! Since this is a "lite" library, the focus is on maintaining a small footprint, high stability, and idiomatic asynchronous Rust. Feel free to open issues or submit pull requests.