Learn how to send the message from the hub to the other clients and handle that render on the screen.
- [Instructor] Our application is now … sending messages to our hub. … Now we just have to complete the loop … and broadcast to clients to notify them … of the new message. … And we also need to hook up our clients … to listen to that event. … We'll start in our chat hub this time. … Let's alter the body of this method … so we're broadcasting to all clients a onNewMessage event. … We'll pass in the message, and the x and y coordinates. … This time it's okay that we're using Clients.All … because we're actually going to just let SignalR broadcast … right back to the sending client to add to the page, … rather than treating our own message as anything special. … Now we'll go back to our client side code, … and register our listener. … Before we do that though, I want to make sure … we return false on our form submit method. … This is going to stop the page from refreshing … when we submit our form. … Now let's add the code for listening to our broadcast. … We'll do chatHub.client.onNewMessage. …
- What is SignalR?
- Scaling out an architecture using SignalR
- Adding a SignalR hub and client to an MVC app
- Authentication with SignalR
- How SignalR groups work
- Adding chat rooms with groups