Skip to content

Instantly share code, notes, and snippets.

@robertiagar
Last active December 22, 2015 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertiagar/6550600 to your computer and use it in GitHub Desktop.
Save robertiagar/6550600 to your computer and use it in GitHub Desktop.
how to kill all your connected clients in signalr. this is just stupid code that I'm sharing. not sure why am I even sharing it.
public class TaskConfig
{
private static IHubContext _context = GlobalHost.ConnectionManager.GetHubContext<BroadcastHub>();
public static void RegisterTasks()
{
var t = new Task(() =>
{
while (true)
{
_context.Clients.All.ranAt(string.Format("The Task ran at {0}", DateTime.Now));
}
});
t.Start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment