SSE Exceptions while publishing notifications

Hi Demis,
we are using server sent events with redis. we have almost no load on the server and see from time to time the following exception:

Error  [ServiceStack.EventSubscription] Error publishing notification to: id: 10
data: claims/33@cmd.onJoin {"userId":"claim System.Web.HttpException The remote host closed the connection. The error code is 0x800704CD.    at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect)
   at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()
   at System.Web.HttpResponse.Flush(Boolean finalFlush, Boolean async)
   at System.Web.HttpWriter.WriteFromStream(Byte[] data, Int32 offset, Int32 size)
   at ServiceStack.ServerEventsFeature.<>c.<.ctor>b__76_0(IResponse res, String frame)
   at ServiceStack.EventSubscription.PublishRaw(String frame)

we added your recommended compression settings:

<urlCompression doStaticCompression="true" doDynamicCompression="false" />

Can you explain why this exception occurs? Is it because it tried to send something to a client which isn’t connected anymore?

another thing maybe worth to mention: it runs on Azure, IIS VM with redis as a service from azure.


Right, the long-running http connection to the client was lost and SSE throws this error when it tries to write to the clients HTTP connection.

ok happy to hear that. but i think the log level feels wrong to me (error…)

No worries, we’re not married to the log-level :slight_smile: modified to Warn in this commit.

yeah luckily we aren’t :smiley:

but if i put errors/warns into prod, I won’t get friends in the ops department :smile:

Exception -> Debug
Info -> some nice verbal message that the client is gone and no message delivered.

i moved it to debug with NLog config :angel:

but anyway thanks for the clarification!