Skip to content

Add Azure Web PubSub emulator - #1048

Closed
Liangying.Wei (vicancy) wants to merge 14 commits into
Azure:mainfrom
vicancy:vicancy-web-pubsub-emulator
Closed

Liangying.Wei (vicancy) wants to merge 14 commits into
Azure:mainfrom
vicancy:vicancy-web-pubsub-emulator

Conversation

@vicancy

@vicancy Liangying.Wei (vicancy) commented Aug 25, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add a production-quality local Azure Web PubSub emulator with WebSocket and REST API support.
  • Generate REST controller routes at build time with a Roslyn source generator, following the runtime analyzer pattern.
  • Support upstream webhooks, Event Hubs publishing, authentication and role boundaries, reliable ack handling, and OData filtering.
  • Implement all six user-scoped REST operations, including multi-connection fan-out, filtering, exclusions, and group membership changes.
  • Implement six connection and group REST operations for filtered bulk membership changes, hub/group close, idempotent remove-all, and stable paged group-member listing.
  • Document supported features and add CI coverage for restore, build, test, and package validation.

Validation

  • dotnet test tools/emulator/tests/Microsoft.Azure.WebPubSub.Emulator.Tests/Microsoft.Azure.WebPubSub.Emulator.Tests.csproj --configuration Release --no-restore
  • 157 tests passed; 0 failed; 0 skipped
  • Release build and package validation passed

Liangying.Wei (vicancy) and others added 13 commits August 25, 2026 20:00
Address five defects found while reviewing the emulator:

- The raw WebSocket path ignored the connection state returned by an event
  handler, so handler-provided state only survived on the JSON path.
- A duplicate connection-state response header threw from SingleOrDefault
  and closed the connection; take the last value instead.
- OData `or`/`and` used short-circuit operators, so an invalid right operand
  escaped validation whenever the left operand already decided the result.
- The disconnected reason was derived from the recoverable flag, so the
  upstream `disconnected` event could not report the real close reason.
- A user event with no handler and no listener acked `BadRequest` instead of
  `InternalServerError`.

Adds regression tests covering both the raw and JSON client paths, plus an
explicit test showing client pub/sub still works on a hub with no event
handlers configured, since only synchronous user events require an upstream
receiver.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b6cd2eff-482c-42de-85e8-731983f10535
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