Skip to content

How to send a realtime notification to specific user in blazor wasm client from asp.net core background service using SignalR in .NET 8 #54204

Closed Locked Answered by fingers10
fingers10 asked this question in Q&A
Discussion options

You must be logged in to vote

@davidfowl Thank you for your time and support. Thank you for your patience. Here is my implementation.

Client Side:

private HubConnection? _hubConnection;
private readonly List<string> _notifications = new();

[Inject] IAccessTokenProvider TokenProvider { get; set; }

[Inject] IConfiguration Configuration { get; set; }

[CascadingParameter] private Task<AuthenticationState> authenticationStateTask { get; set; }

protected override async Task OnInitializedAsync()
{
    var authState = await authenticationStateTask;
    var user = authState.User;

    if (user.Identity.IsAuthenticated)
    {
        _hubConnection = new HubConnectionBuilder()
                        .WithUrl($"{Configuration.

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
2 replies
@fingers10
Comment options

@davidfowl
Comment options

Comment options

You must be logged in to vote
8 replies
@fingers10
Comment options

@davidfowl
Comment options

@fingers10
Comment options

@fingers10
Comment options

@fingers10
Comment options

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