Skip to content

Instantly share code, notes, and snippets.

@Buildstarted
Created December 8, 2011 00:28
Show Gist options
  • Save Buildstarted/1445495 to your computer and use it in GitHub Desktop.
Save Buildstarted/1445495 to your computer and use it in GitHub Desktop.
public class HomeController : Controller
{
//
// GET: /Home/
private IEventStream stream;
public HomeController(IEventStream stream)
{
this.stream = stream;
}
public ActionResult Index()
{
Task.Factory.StartNew(() => {
//wait 5 seconds then send the messages
System.Threading.Thread.Sleep(5000);
stream.Send("this is a string event");
stream.Send("title-description", new { Title = "Titlebar", Description = "This is a more complex type" });
stream.Send(new Profile { Name = "Ben Dornis", Bio = "This is a biography"});
});
return View();
}
}
public class Profile
{
public string Name { get; set; }
public string Bio { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment