Created
July 19, 2012 15:27
-
-
Save karlitros/3144671 to your computer and use it in GitHub Desktop.
Broadcasts the update to all connected clients using SignalR. I've done this within the controller to demonstrate server -> client pushing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Broadcasts the update to all connected clients. I've done this directly in the controller to | |
/// demonstrate server -> client pushing, rather than client -> client pushing. | |
/// </summary> | |
/// <param name="updateItem">The update item.</param> | |
internal static void BroadcastUpdate(Update updateItem) | |
{ | |
// Fetch the hub's context to broadcast | |
IHubContext context = GlobalHost.ConnectionManager.GetHubContext<LiveUpdate.Hubs.LiveUpdateHub>(); | |
// Call the hub's feedUpdated method with our news / event item. | |
context.Clients.feedUpdated(updateItem); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment