Skip to content

[WebPubSub] Support invoke_event for webpubsub client#45450

Open
MoChilia wants to merge 9 commits intoAzure:mainfrom
MoChilia:invoke
Open

[WebPubSub] Support invoke_event for webpubsub client#45450
MoChilia wants to merge 9 commits intoAzure:mainfrom
MoChilia:invoke

Conversation

@MoChilia
Copy link
Member

Description

Adds a preview invoke_event API to the Web PubSub client SDK, enabling request-response style communication with upstream event handlers. The client sends an invoke request, awaits the correlated invokeResponse, and returns the result, or raises InvocationError on failure/timeout.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@MoChilia MoChilia requested a review from chenkennt as a code owner February 28, 2026 07:48
Copilot AI review requested due to automatic review settings February 28, 2026 07:48
@MoChilia MoChilia requested a review from Y-Sindo as a code owner February 28, 2026 07:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a preview invoke_event request/response API to WebPubSubClient (sync + async), enabling upstream-event invocation with correlated invokeResponse handling, plus associated protocol/model updates and unit tests.

Changes:

  • Introduces new invoke/cancel/invokeResponse message models and invocation management helpers.
  • Adds invoke_event implementation to sync and async clients with correlation and error mapping via InvocationError.
  • Updates unit tests/protocol parsing and README documentation for the new preview feature.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
sdk/webpubsub/azure-messaging-webpubsubclient/tests/test_unit.py Adds protocol write/parse coverage for invoke/cancel/invokeResponse frames.
sdk/webpubsub/azure-messaging-webpubsubclient/tests/test_invocation_manager.py Adds sync InvocationManager unit tests.
sdk/webpubsub/azure-messaging-webpubsubclient/tests/test_invocation_manager_async.py Adds async InvocationManagerAsync unit tests.
sdk/webpubsub/azure-messaging-webpubsubclient/azure/messaging/webpubsubclient/models/_models.py Adds new invoke-related models, protocol parse/write support, and invocation managers/errors.
sdk/webpubsub/azure-messaging-webpubsubclient/azure/messaging/webpubsubclient/models/_enums.py Extends upstream message types to include invoke/cancelInvocation.
sdk/webpubsub/azure-messaging-webpubsubclient/azure/messaging/webpubsubclient/models/init.py Exposes new public result/error types and InvocationError.
sdk/webpubsub/azure-messaging-webpubsubclient/azure/messaging/webpubsubclient/aio/_client.py Implements async invoke_event, integrates invokeResponse dispatch and disconnect rejection.
sdk/webpubsub/azure-messaging-webpubsubclient/azure/messaging/webpubsubclient/_client.py Implements sync invoke_event, integrates invokeResponse dispatch and disconnect rejection.
sdk/webpubsub/azure-messaging-webpubsubclient/README.md Documents invoke_event usage (preview).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants