Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for subscription events to WebView's tRPC #2522

Merged
merged 8 commits into from
Dec 13, 2024

Conversation

tnaum-ms
Copy link
Collaborator

This PR introduces enhancements to the appRouter and the WebviewController to enable strongly typed event subscription support within a webview.

fixes #2516

Enhancements and new features:

  • Subscription Procedures:

    • Introduced demoBasicSubscription and demoComplexSubscription to demonstrate streaming data from the server to the client using asynchronous generators. These subscriptions handle various scenarios, including client-side unsubscription and server-side abort signals.
  • Router Configuration:

    • Added a new demoRouter to the appRouter to organize and manage the new subscription procedures.
  • WebviewController Enhancements:
    This pull request to src/webviews/api/configuration/appRouter.ts and src/webviews/api/extension-server/WebviewController.ts introduces new subscription procedures and enhanced documentation. The most important changes are grouped by theme below:

New Features:

  • Introduced demoBasicSubscription and demoComplexSubscription procedures to demonstrate how to stream data from the server to the client using asynchronous generators.

Enhancements:

  • Added signal property to BaseRouterContext to support subscription cancellation.

Documentation:

  • Improved documentation for WebviewController to clarify its usage with tRPC for handling requests from the webview.
  • Added detailed comments and usage examples for new subscription procedures to guide developers on how to implement and use them.

Code Organization:

  • Updated appRouter to include the new demoRouter for better modularity.
    These changes collectively enhance the functionality, error handling, and integration capabilities of the application, providing a more robust and flexible development environment.

@tnaum-ms tnaum-ms marked this pull request as ready for review December 12, 2024 10:12
@tnaum-ms tnaum-ms requested a review from a team as a code owner December 12, 2024 10:12
@tnaum-ms tnaum-ms merged commit 816954b into main Dec 13, 2024
2 checks passed
@tnaum-ms tnaum-ms deleted the dev/tnaum/#2516-support-for-subscriptions-in-trpc branch December 13, 2024 11:44
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.

Add support for subscription events to WebView's tRPC
2 participants