Building Real-Time Applications With SignalR & .NET 7

preview_player
Показать описание

SignalR is probably the most enjoyable library to work with in .NET. You can add real-time functionality to your application for notifications, chat, and async data updates. What's not to like?

SignalR is also easy to work with since there's just one concept - the Hub class. And everything builds on top of it.

Adding Real-Time Functionality To .NET Applications With SignalR

SignalR in dotnet tested with Postman

Join my weekly .NET newsletter:

Using Postman with SignalR WebSockets Development

Read my Blog here:

Subscribe for more:

Chapters
0:00 Installing the SignalR NuGet package
0:59 Creating your first SignalR Hub
3:34 Exposing the Hub from the API
4:04 Connecting to SignalR with Postman WebSocket Request
6:02 Calling the Hub message from the client
7:48 Creating a strongly typed hub
9:41 Calling client methods from the server side with IHubContext
Рекомендации по теме
Комментарии
Автор

Nicely narrated. I do like the strongly typed hub section a lot, you stand out with that one from the rest of the field. The postman part is also a nice touch.

majormartintibor
Автор

For those who want to know, the final character in message is the 30 of ASCII table

brunohenrigarcia
Автор

There is also the experimental package that allows you to generate clients based on the interface for a typed client and a interface describing the methods on the hub. Comes in handy with Blazor since it can just register a component which implements the typed client interface - automatically setting up the handlers. And then you can use the proxy to call the hub methods.

marna_li
Автор

Thank you Milan for this introductory video. I'm just learning the SignalR and this video helped me a lot. Also, It's great to see the best trilogy of WoW displayed background :D

Yetemedim
Автор

A very nice touch, I like the strongly typed hub section. More videos on SignalR particularly on authorization will be nice.

AbuBakrSadiqi-bt
Автор

You're the best! Links to another video in the end are very useful! Thank you for these videos.

МаксимВеснин-иэ
Автор

Thank you for the overview, was well and quickly explained. For the example I whished you'd had shown a short example which makes more sense, like sending a continous heartbeat to the clients which communicate server health. Doing always A->B action mapping is not an enlightening example in my opinion (posting to the endpoint to trigger the WS push).

teckyify
Автор

Very simple and helpful explanation. Thank you.

DiogoLScarmagnani
Автор

Signalr is great. But i always wondered how notifications are done. Like for mobile apps also when they aren't running (maybe a background task with the app). With Emails you probably have an Email notification service somewhere in the backend for handling all the emails from the different services. But how could i handle push notifications?

flobuilds
Автор

Thank you very much for this tutorial Milan.
I did the same except for installing the SignalR client package. When I connect from postman I only receive one message saying that it's connected, but the ChatHub class breakpoint does not hit in VS !!!

omarbousbia
Автор

thanks for explaining the main points, I would like to hear about error handling in the hub methods.

amayweather
Автор

A better example would be to create two frontend applications(React/Blazor) and have them talk to each other or sending events from frontend to backend or vice-versa.

vivekkaushik
Автор

in my Postman shows that hub is connected successfully, but OnConnectedAsync is NOT invoked, accordingly no messages can be sent

shabtaiben-david
Автор

SignalR seems very cool. Just waiting for the right project to come my way. Would be interested to see your take on implementing the client side.

andythebritton
Автор

Hi Milan. How would you use SignalR with clean architecture and DDD? The way I see it: some domain entity raises a domain event, the event is saved to the database OnSavingChangesAsync using the outbox pattern. Then some background worker like Quartz picks up that event, and uses correct handler in application layer. Now, how should I reference the Hub in the application layer? Because I feel like using IHubContext<THub> is a leaky abstraction. Maybe a better approach would be to use an interface like IMessageSender, that would be implemented in infrastructure layer, and then IHubContext<T> could be injected without polluting the application layer?

matthewrossee
Автор

What extension is it that lets your autocomplete show all the possible overloads of the function you are calling?

InuyashaITB
Автор

I think that if we using endpoint to send message, we can use [Authorize] attribute on it instead of putting attribute on Hub method, yes? Sorry for sometimes bad english, I am not native speaker

classc
Автор

Strict to the point, thank you very much for sharing this knowleadge.

rodrigoboanergesoliveira
Автор

Great video and Great share!!! Perfect explanation of signalR. Thank you for sharing

vittoriomorellini
Автор

Worth to mention: methods with optional parameters (I mean those with default value eg. int i = 0) may be ignored by your hub with strongly-typed client interface.
This is what I was struggling with for long hours..

fikolec