No video

Intro to SignalR in C# Part 2 - Beyond Chat Applications

  Рет қаралды 26,886

IAmTimCorey

IAmTimCorey

Күн бұрын

SignalR is for more than just chat applications. In our last video, we saw the standard demo for SignalR, where we could connect multiple clients to a chat hub. In this video, we are going to extend that demo by adding a second hub. This one will trigger the counter on the Blazor page from our WPF project.
Full Training Courses: IAmTimCorey.com
Source Code: leadmagnets.ap...
Mailing List: signup.iamtimc...

Пікірлер: 90
@codefoxtrot
@codefoxtrot 2 жыл бұрын
Thanks Tim! Looking forward to parts 3, 4, 5 & 6... or better yet a published course on your site for more of this. These first two parts were definitely a great ice-breaker, at least for me, since I hadn't yet explored SignalR. Sometimes you have to turn off the learning, in favor of getting stuff done. Nevertheless, your videos always save me time compared with self-learning, so when I saw the notification for SignalR Part 1, I couldn't resist. So thanks again!
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Thank you! And thanks for the suggestion.
@_Szakal
@_Szakal Жыл бұрын
we need mroe for signalR. Maybe u may say about how to store messages so every new client can connect and see messages when he was not avilable. Moreover same scenario just when particural user send to any other specific user like in the chat app like Whatsup.
@DavidMartin-vs1dm
@DavidMartin-vs1dm 10 ай бұрын
How to send to specific clients would be great.
@Simnico99
@Simnico99 2 жыл бұрын
Really great video, I've learned alot about signalR but I would like to know how to broadcast to only a certain amount of people like admins recieving notifications about something etc.
@aah134-K
@aah134-K 2 жыл бұрын
Track them when signal r connect, with a dictionary forexample user to connectio. Id, user roles to connection ids and so fourth. When you want to prodcast to admin get all admin "whom are connected" and send message to thwm
@dove227
@dove227 2 жыл бұрын
You can add the admins to a group and send whatever message to them. Or track admins with a database or dictionary
@chechobecho2177
@chechobecho2177 2 жыл бұрын
Thank You.. It is just Iftar gift for me.. I can't watch this right now... I will watch after Ramadan Iftaar.. Thank You Tim Corey ❣❣
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
You are welcome.
@matthewmoore265
@matthewmoore265 Жыл бұрын
Thanks for the help this video provided! I'd love to see a video about what security, authentication, authorization, etc. is available in SignalR, and how to implement them.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
@JackNotJack
@JackNotJack Жыл бұрын
Tim, thank you for demystifying SignalR. Great tutorials as always. Much appreciated.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
You are welcome.
@kellyeosoba5854
@kellyeosoba5854 2 жыл бұрын
What a great tutorial. Thank you so much. I will love to see the advance part where one can send message to specific client
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
@ManuelBasiri
@ManuelBasiri 2 жыл бұрын
Thanks for this. I thought part 2 would take longer but you pulled it off so quickly. Going to allocate some time to absorb your knowledge fully.
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
You are welcome.
@pierreplourde
@pierreplourde 2 жыл бұрын
I agree: that would be a great Part 3.
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
What are you looking for in part 3?
@pierreplourde
@pierreplourde 2 жыл бұрын
@@IAmTimCorey Sorry, I was meaning to put that in reply to @Simnico99's (kzfaq.info/love/QRVFuD0t68EyxV8Hl0Ypfg) comment asking about "how to broadcast to only a certain amount of people like admins receiving notifications about something etc." It was not meant to be a top-level comment. ☺️
@satyabratamohapatra3397
@satyabratamohapatra3397 2 жыл бұрын
Another great video. Thanks Tim. It takes so much time and effort to create this type of tutorial. Thanks again.
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
You are welcome.
@leonardzmalaj8038
@leonardzmalaj8038 2 жыл бұрын
Hi Tim !You are doing an excellent job , but in this video I was waiting to see how to send data to specific users not to everyone equally. hope to make a video for this. Thanks !!
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
@manwatermelon
@manwatermelon 2 жыл бұрын
Hey, Tim! Would be great to understand how to send the messages to specific clients. Imagine whispers or private messages on chat apps.
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
2 жыл бұрын
Hi, nice video, thanks. One important feature that was not mentioned is the capability to send menssages to a specific user, even if the user is not logged in. Like send a message for a specific visitor session on a website...
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
I mentioned it but I did not show it. That's a more complicated process that would have been too long to add to a video. It would need to be its own video.
2 жыл бұрын
@@IAmTimCorey Hi, thanks so much for answering. Actualy I've already done sending individual messages... had to find out how to do it on my own, but it would be a very good video to make. A whole series on SignalR. It's a very good tool with so many applications...
@cissemy
@cissemy 2 жыл бұрын
Thanks Tim. Blazor is powerful.
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
You are welcome.
@cissemy
@cissemy 2 жыл бұрын
@@IAmTimCorey Using Signal R how to display a driver locations on the map like uber ?
@ayanpoddar5041
@ayanpoddar5041 2 жыл бұрын
please more videos about signal r. and what other compression is able out of the box and which one best??
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
@woodandgears2865
@woodandgears2865 Жыл бұрын
Great presentation. Thanks! Would love to see signalR authentication covered at the same level. Subscribing!
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
@grzesiekhallomoto5920
@grzesiekhallomoto5920 2 жыл бұрын
Very nice work!!! As always great!
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Thanks!
@Shazbot277
@Shazbot277 2 жыл бұрын
thank you for the 2 part series, good intro to Blazor and SinglR. The only issues i had was an outdated Visual Studio and the restrictions my organization placed on my laptop where I couldn't run the WPF App. Even though I have admin rights it keeps saying "Access Denied".
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
You are welcome.
@AnimeZone247
@AnimeZone247 Жыл бұрын
how do we save this information? Let's say a user closes its client, and open it back up, How can the user see where they last left off from?
@ranielgarcia8685
@ranielgarcia8685 2 жыл бұрын
Hey Tim, Thank you for this tutorial again! Can we use SignalR for trading applications?
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Yes you can!
@aarondouglas3220
@aarondouglas3220 2 жыл бұрын
Would love to see a video on broadcasting changes from and SQL Server database to connected clients.
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
@faustoluis5486
@faustoluis5486 2 жыл бұрын
Hi, Tim. I would like to avoid "magic strings" in the method names. What's the best practice? Using interfaces, for instance?
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Probably just string constants, maybe in a shared library so that other projects can use the same constants. It won't solve all of the naming issues, though, since some are method names that then correspond to strings. For that, you might try "nameof()", but that might get hacky.
@sh2983
@sh2983 2 жыл бұрын
Hi Tim, thank you for the video. I need to know more about where to host my application using SignalR with maybe 100 users connected at the same time and chatting and playing together. And also some information about Azure SignalR pricing. Thanks
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
You can host your app anywhere with just 100 concurrent connections. That's not really a big deal. 10,000 would be where I would start looking for other solutions. However, if you want to offload your SignalR connections anyway, you could do so for $50/month if you hosted on East US: azure.com/e/62513f4b4772453ab8a051795e515784 Note that this plan covers 1,000 concurrent connections and gives you 1,000,000 messages for free before it starts charging you for additional messages.
@uppercat7268
@uppercat7268 2 жыл бұрын
A third part would be nice regarding to use signalR with javascript in the client.
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
@Terminator090909
@Terminator090909 2 жыл бұрын
Thanks
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
You are welcome.
@psisco2
@psisco2 2 жыл бұрын
Great as usual. I've just one request if you can explain the SignalR + Newtonsoft.Json or MessagePack protocols. Thanks
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
@hastifallah73
@hastifallah73 2 жыл бұрын
Waiting for part three😁
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
There isn't a part 3 scheduled. What would you like to see in a part 3?
@eskpetri
@eskpetri Жыл бұрын
Thanks for the video. I added .MAUI project in worked well in windows application but Android real device and emulator didn't. adb reverse tcp:7181 tcp:7181 Used above to get access localhost:7181 but got following error message "java.security.cert.CertPathValidatorException: Trust anchor for certification path not found" Do you might know what to do next? Do I need self signed certificate? Override some security classes?? Change some security options? Kind of stuck. Self signed certificate sounds next to try.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
It sounds like your emulator does not trust the certificate. Self-signing won't change that (you already have a self-signed certificate for your API). What you need to do is trust that certificate. That would be my guess.
@sergiq2
@sergiq2 2 жыл бұрын
Let's imagine that I have Web API and additionaly SignalR for notifications. - Is there a way to share authentication data between those 2 server side services ?, - Do I need to invoke SignalR method from client side (frontend: update something via Web API method, than send notification) or I can do it from backend (frontend: update something via Web API method (for ex. ApproveFollower), backend: inside Web API method ApproveFollower, send a notfication to the follower user via SignalR) ?
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Yes, they can share authentication. Yes, you can alert the clients from the server. You can't establish a connection from the server to the client, though. The client needs to be the one to establish a connection.
@AvgDan
@AvgDan 2 жыл бұрын
A single NIC is limited to 65536 simultaneous connections IIRC. What's available for web sockets would be slightly less.
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
I think this is a confusion on network ports vs network connections. You can (and do) have multiple connections over one port. Web servers, for instance, usually use port 443 for serving a website, yet they can have more than one visitor at a time. A network card has roughly 65,000 ports that can be used simultaneously. For instance, on the same server you can be using FTP on port 21. With SignalR, you are using the web communication channel (usually port 443) for all communication. Inside of it, you can have multiple WebSocket connections at once. By default, IIS limits you to 5,000 connections per CPU, but you can increase that dramatically. The bottleneck, though, will be the server's ability to keep track of all of those links. Even the bandwidth won't really be a problem, since you usually send very small packets across the wire. 100,000 clients sending 1kb packets would only result in a 100MBps transfer rate. It is a rare business that cannot sustain that much traffic to their commercial site. That's why the bigger problem is the computer driving all of those changes at once. It will have a lot of bottlenecks trying to talk to 100,000 clients at once.
@AvgDan
@AvgDan 2 жыл бұрын
​@@IAmTimCorey You're right of course, excuse the brain fart! Thanks for the videos! I tried out gRPC per another of your videos to make a client/server app (both in winforms) so I could send keystrokes I hooked from a VMware guest to the host so my multimedia keys would function on my host. It took forever to figure that out because when your mouse is hovering over a VM window, VMware will hijack the keydown/up messages you want to send via SendMessage and send those messages back to the guest, creating an endless loop!. I finally figured that out, but ended up ditching gRPC and using SignalR because I got stuck on an issue with gRPC not working in Win7 VMs due to an http/ssl version issue I think. I figured I'd give SignalR a shot to learn a bit about it. I don't think I'll ever try gRPC again just because I didn't like the gotchas you warned us about, because they got me even after your warning.
@filix2455
@filix2455 2 жыл бұрын
Part 3, UI dashboard please?
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
@naturalwong6884
@naturalwong6884 2 жыл бұрын
Thank you for a short and clear work. If I need a web app on the client side, can I create a ASP razor page app as client to be run on non windows device?
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Yes, you can. You can also create a JavaScript client (no C#) or clients in other languages.
@geoffmassey3861
@geoffmassey3861 Жыл бұрын
Great demo of SignalR - I have done Tim's Blazor Server course which also demos SQL connections. I just wondered whether Tim could demo using SignalR to stream data from the data base. Also I'm interested in using SignalR to receive location data from a mobile phone and the display this real time on a google map - any thoughts on this?
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
@rezakhakpour9410
@rezakhakpour9410 2 жыл бұрын
thank you tim for your awesome educational content. i have a question about writing tests for signalR. is there a recommending way to write tests rather than just mocking in unit tests? for example is it a good idea to bring up all dependencies with docker and test if chatHub is working properly? im asking this because all the time my frontend says that something on serverSide is not working properly and then i should test my release on stage server by bringing up a console app(using Microsoft.AspNetCore.SignalR.Client) which acts as the client and test the stage server like that.
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Unit tests test just one unit of work. They don't test the interconnected system. It sounds like you are wondering about end-to-end testing. That can be a good thing, although it is tricky to get right, expensive to build, and it will be constantly changing. That means that you don't do it very often and you don't do many of them. The way to do it would probably be to spin up a full setup in Docker or something else where you can reset the environment easily. However, in this specific case, it sounds more like you are having a problem in production and need to track down what is going wrong. In that case, good logging is a better option. That way, you can read through the logs and identify what went wrong.
@datascienceandmachinelearn2537
@datascienceandmachinelearn2537 2 жыл бұрын
Hi Tim, can you make a video for Signal R connection with angular?
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
@bootsector13
@bootsector13 2 жыл бұрын
Hi Tim, is there any difference between InvokeAsync(StateHasChanged) and StateHasChange()
@diegoronkkomaki6858
@diegoronkkomaki6858 2 жыл бұрын
InvokeAsync is needed when you know that the code might be executed on a background thread and the code modifies components/objects owned by the UI thread. Without InvokeAsync you will run into exceptions being thrown if you try to run StateHasChanged from a thread other than the main UI thread.
@Steffedyret
@Steffedyret 2 жыл бұрын
Hi Tim, Thanks for these SignalR videos. Your sample works fine when I run it on one machine with the server app running from Visual Studio. But I get a 'No connection could be made because the target machine actively refused it. (localhost:7181)' when I run the WPF app on another machine on same wifi. Have you got a tip?
@diegoronkkomaki6858
@diegoronkkomaki6858 2 жыл бұрын
Running multiple devices on the same wifi network does not mean you can connect to other devices localhost. Each device has their own localhost, you can think of localhost as the current device itself. So your WPF application is trying to connect to a server running on that same specific device, but fails, because there is no server running on the WPF machine's localhost.
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
The best thing to do would be to publish your SignalR server to a web server. They are designed to be reachable by other machines on the network, or even across the Internet. You can set up your local machine to be a web server. This video will show you how: kzfaq.info/get/bejne/hraRpLmqp9HbfZ8.html Just note that you will then need to make sure your local machine's firewall permits access on the correct ports, plus you will need to add a SSL certificate on your local machine that the other machines trust, plus you will need to access your machine remotely using your machine's IP address. As @Diego pointed out, the word "localhost" represents the machine you are on. That doesn't work when you want to access a remote machine. In that case, you would access it by the IP address.
@molindio
@molindio Жыл бұрын
Otherthan WPF, Can this work with winform project type as a client?
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Sure. It can work with almost any client.
@molindio
@molindio Жыл бұрын
@@IAmTimCorey Thanks
@MohammadKomaei
@MohammadKomaei 2 жыл бұрын
Could you send the github link for this sample?
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
I don’t have a GitHub link. There is a link in the description to download the source.
@imsuveen
@imsuveen 2 жыл бұрын
How to publish SignalR on Heroku?
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
@Lazzerman42
@Lazzerman42 2 жыл бұрын
Great video! Question: How do I get Vs2022 to insert Pattern: Method: Page: etc ? @IAmTimCorey
@thomasadams5446
@thomasadams5446 Жыл бұрын
Tim, do you have any resources on working with groups and how to send messages to specific groups of users and connection pools? I have it working somewhat, but the amount of messages being dropped is astronomically high. Approximately half or more messages are dropped so I think I may be doing something incorrectly.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
I don't have an example of that yet, sorry.
@thomasadams5446
@thomasadams5446 Жыл бұрын
@@IAmTimCorey Okay. I have been fighting with setting up Azure SignalR via a deployed API and connecting to receive messages via a JavaScript client. Talk about a headache.
Intro to MediatR - Implementing CQRS and Mediator Patterns
1:21:50
IAmTimCorey
Рет қаралды 222 М.
wow so cute 🥰
00:20
dednahype
Рет қаралды 29 МЛН
王子原来是假正经#艾莎
00:39
在逃的公主
Рет қаралды 9 МЛН
КАКУЮ ДВЕРЬ ВЫБРАТЬ? 😂 #Shorts
00:45
НУБАСТЕР
Рет қаралды 3,4 МЛН
Мы сделали гигантские сухарики!  #большаяеда
00:44
Real-Time Revolution: SignalR in Action - Kevin Griffin - NDC London 2022
1:06:04
Александр Кузнецов - Введение в Microsoft SignalR
56:53
DotNext — конференция для .NET‑разработчиков
Рет қаралды 2,6 М.
10 C# Libraries To Save You Time And Energy
33:59
IAmTimCorey
Рет қаралды 206 М.
Intro to Redis in C# - Caching Made Easy
1:27:29
IAmTimCorey
Рет қаралды 176 М.
Stop using async void in C#! Do this instead.
13:12
Nick Chapsas
Рет қаралды 57 М.
Why would I use SignalR over calling WebSockets directly?
7:46
Microsoft Developer
Рет қаралды 7 М.
Turns out REST APIs weren't the answer (and that's OK!)
10:38
Dylan Beattie
Рет қаралды 149 М.
ASP.NET Core SignalR - WebSockets Deep Dive
17:15
Raw Coding
Рет қаралды 20 М.
wow so cute 🥰
00:20
dednahype
Рет қаралды 29 МЛН