Hi Demis, is ServerEvents.NotifyAll call a blocking call?
I’ve got a strange problem, I’m running TcpListener and accepting several connections at once (using async/await). When processing data received from each connected client I found out some of them seem to freeze at the exact moment of calling ServerEvents.NotifyAll
I’ve set up logging and I’m logging right before and right after the call, yet for some of the connected clients the log ends with “sending SSE” (which is of course the message right before calling NotifyAll)
Well it writes to the ASP.NET Response OutputStream and flushes it. It’s blocking in that it should have written to the OutputStream after it’s flushed but when there’s no longer a HTTP connection writing and flushing the response stream still succeeds so ASP.NET might be using a buffered stream and/or separate I/O thread to do the writing to the socket.
Michał Gajek:
ok I’m starting it in new task with cancellation token (a few seconds delay) which I’m not awaiting, now it doesn’t block. Thanks!
Sir Thomas:
Good tip. Landed on this too.