Skip to content

Conversation

@V3RON
Copy link
Contributor

@V3RON V3RON commented Dec 28, 2025

Description

The RPC bridge allows both sides to expose methods and call remote methods using a single shared channel. It uses JSON-RPC 2.0 protocol and ES6 Proxy to provide natural method calling syntax like await devTools.refresh(). Errors are automatically serialized and propagated. The implementation is opt-in, allowing coexistence with existing event-based communication patterns.

Related Issue

None

Context

Previously, communication between apps and DevTools used an event-based messaging pattern where each side sent messages and listened for responses. While this was type-safe, it required manual promise management, call ID tracking, and custom request-response handling for each interaction. The RPC bridge provides a method-calling abstraction that automatically handles request-response pairing, promise management, and error propagation. This reduces boilerplate code and provides a more natural API for bidirectional method calls while maintaining backward compatibility with existing event-based communication.

Testing

Unit tests using Vitest cover remote method calls, incoming request handling, error propagation in both directions, and opt-in compatibility with non-RPC messages. Tests use a mock transport layer to verify the full request and response cycle, including error serialization and promise management.

@vercel
Copy link

vercel bot commented Dec 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
rozenite Skipped Skipped Jan 7, 2026 9:11am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants