Skip to content

SignalR custom dispatching in ASP.NET Core 3.1 #23508

Answered by lorenzrox
lorenzrox asked this question in General
Discussion options

You must be logged in to vote

Implement my own.
I need to handle the InvocationMessages myself and dispatch them to my generic dispatcher instead of the SignalR hub.

This is what I have in 2.2:

interal sealed class ServiceHubDispatcher<TService> : HubDispatcher<Hub<TService>>
        where TService : class
{
        ...

        public override async Task OnConnectedAsync(HubConnectionContext connection)
        {
            //Create custom connection context that holds my generic dispatcher
        }

        public override Task OnDisconnectedAsync(HubConnectionContext connection, Exception exception)
        {
            //Remove and dispose custom connection context
        }

        public override Task Dispat…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@davidfowl
Comment options

Answer selected by lorenzrox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants