feat(broadcasting): SignalR hub + @simplemodule/echo client (closes #169)#193
Merged
antosubash merged 1 commit intoMay 11, 2026
Conversation
) Adds real-time push from server to browser. Modules raise events that implement IBroadcastEvent (or call IBroadcaster directly); a Scrutor decorator over Wolverine's IMessageBus mirrors those events to clients through the BroadcastHub at /hub/broadcast. - Framework abstractions in SimpleModule.Core/Broadcasting: IBroadcaster, IBroadcastEvent, [BroadcastEvent], IBroadcastChannelAuthorizer, IBroadcastContext, BroadcastChannels, wire envelopes. - SimpleModule.Hosting: BroadcastHub, SignalR-backed Broadcaster, PresenceTracker, BroadcastAuthorizerChain with default user/tenant guards, BroadcastingMessageBus decorator. - @simplemodule/echo: SignalR-backed client with EchoProvider, useEvent, usePresence; ref-counted subscriptions, auto-reconnect, presence snapshots. - Demo: /broadcasting page in the Dashboard module with live tick counter and a fire button hitting an authenticated IBroadcaster route. - Tests: 22 unit + integration tests covering attribute discovery, presence tracking concurrency, authorizer chain, and the bus-decorator forwarding path.
Deploying simplemodule-website with
|
| Latest commit: |
c0200a7
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4d5f96fb.simplemodule-website.pages.dev |
| Branch Preview URL: | https://feature-feat-broadcasting-si.simplemodule-website.pages.dev |
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
Adds real-time push from server to browser. Modules either implement
IBroadcastEventon a domain event or callIBroadcasterdirectly; a Scrutor decorator over Wolverine'sIMessageBusforwards everyIBroadcastEventpublish to SignalR clients connected toBroadcastHubat/hub/broadcast.SimpleModule.Core/Broadcasting/):IBroadcaster,IBroadcastEvent,[BroadcastEvent],IBroadcastChannelAuthorizer,IBroadcastContext,BroadcastChannels, wire envelopes.SimpleModule.Hosting/Broadcasting/):BroadcastHubwithSubscribe/Unsubscribe+ presence join/leave, SignalR-backedBroadcaster,PresenceTracker,BroadcastAuthorizerChain(longest-prefix wins) with default user / tenant guards, andBroadcastingMessageBusdecorator.@simplemodule/echo): SignalR-backed Echo class withEchoProvider,useEvent,usePresence; ref-counted subscriptions, auto-reconnect with re-subscribe + presence snapshot re-dispatch, in-flight subscribe deduplication./broadcastingpage in the Dashboard module — connection status badge, live tick counter, and a fire button hitting an authenticatedIBroadcaster.ToUserAsyncroute.docs/broadcasting.md.Verification
connected, three "Fire tick" clicks incremented the in-page counter 0→1→2→3 with timestamps, no broadcasting-related console errors.npm run check,npm run build,dotnet build,dotnet test(1010/1010 across 17 projects),npm run test:smoke -w tests/e2e(47/47).Test plan
BroadcastingMessageBusdecorator and theBroadcastAuthorizerChainlongest-prefix matching