docs(flashblocks): add WebSocket streaming guide to app-integration#1300
Open
erhnysr wants to merge 2 commits intobase:masterfrom
Open
docs(flashblocks): add WebSocket streaming guide to app-integration#1300erhnysr wants to merge 2 commits intobase:masterfrom
erhnysr wants to merge 2 commits intobase:masterfrom
Conversation
Adds a clarification note about using the correct RPC endpoint when building on Base.
The app-integration page covered RPC usage (viem, wagmi, ethers) but had no documentation for direct WebSocket streaming — a common pattern for real-time use cases like address monitoring and mempool tracking. Added a new WebSocket Streaming section covering: - Endpoint URLs for mainnet and sepolia - Flashblock message format (Brotli-compressed JSON, index 0 vs diff) - Basic connection example with Brotli decompression - Auto-reconnect with exponential backoff for production use - Address watcher pattern for real-time tx monitoring All examples are TypeScript and use only the built-in zlib module plus the ws package — no additional dependencies required.
Collaborator
🟡 Heimdall Review Status
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
app-integrationpage documented RPC usage (viem, wagmi, ethers.js) but had no coverage of direct WebSocket streaming — a pattern commonly needed for real-time applications like address monitors, trading dashboards, and gaming apps.Changes
Added a WebSocket Streaming section to
docs/base-chain/flashblocks/app-integration.mdxcovering:index: 0(full block header) vsindex: 1-9(diff only), with a JSON exampleWhy this matters
Flashblocks' primary value proposition is sub-200ms latency. That benefit is only reachable via WebSocket — polling the RPC every 200ms defeats the purpose. Developers building real-time apps currently have no documented path to use the WebSocket stream.
Notes
ws(npm) and Node's built-inzlib— no extra packages