cloudflare / cloudflare/lol-html
grpc server for lol-html
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 111
- PR merge metrics
- No merged PRs in 30d
Description
I've been building on lol-html and wanted to share what came out of it: grpc-lol-html, a gRPC server that sits directly on the lol-html streaming rewriter.
It'll stream the HTML in over one connection, and matched elements stream back out as the parser finds them. Like the API, one can declare CSS-selector rules up front; the server compiles them once and emits typed events (elements, text, comments, doctype) with source spans as it parses. As a demo I included three demo clients (Java, Node with a live web viewer, Python).
Over a real socket it sustains ~178 MiB/s, faster than building a DOM in the same process, and the bench harness refuses to print numbers unless the wire stream is byte-identical to in-process lol-html.
https://github.com/ai-pipestream/grpc-lol-html
Run it in a minute:
```bash
cargo run --release # listens on 0.0.0.0:50051
# or: docker build -t grpc-lol-html . && docker run -p 50051:50051 grpc-lol-html
# then any demo, e.g.:
cd demos/python-client && ./run.sh ../sample-data/cdata_svg.html "a[href]"
# or the web viewer: cd demos/node-client && npm install && npm start
```
I'll keep enhancing and maintaining it, and if you host it in your main repo, I can move it to a BSD license.
Contributor guide
Research direction
The issue provides no in-repository file or test to modify. Start by reviewing the linked grpc-lol-html repository and its cargo run --release entry point, then establish whether the main repository wants to host it; done would require a maintainer decision on integration and licensing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc, rust
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100