-
Notifications
You must be signed in to change notification settings - Fork 183
Open
Description
I am sending sse events to my clients;
HTTPContext.onClose should fire if the http connection is closed; however it never does.
[Route(HttpVerbs.Get, "/alarms")]
public async Task<string> ReadAlarms() {
Response.ContentType = "text/event-stream";
CancellationTokenSource source = new CancellationTokenSource();
HttpContext.OnClose((IHttpContext context) => {
source.Cancel();
});
while(!source.Token.IsCancellationRequested) {
await Task.Delay(1000);
await Response.OutputStream.WriteAsync(new byte[] { 46 },0,1);
}
}
Am i doing something wrong here?
Edit: also tried setting server.Listener.IgnoreWriteExceptions = false with no success: no exception thrown ever (#457)
It did work for #317; could using a controller/Route make a difference?
Metadata
Metadata
Assignees
Labels
No labels