Search code examples
c#.netnancyserver-sent-events

Server sent events with Nancy


How do I create server sent events with Nancy. I got only to return a single line, but I am not sure how to trigger the new events in my code.

This is what I have so for in my module:

 Get["/events"] = _ =>
 {        
  return Response.AsText(string.Format("data: {{\"date\":{0}}}\n\n", DateTime.Now.Ticks), "text/event-stream");
 };

Solution

  • I would probably use Nancy + SignalR and host it on OWIN