SSE inside docker (windows)

I am running servicestack inside a windows docker container on server 2016 and finding server events are not working properly.

What specifically is happening is when my web site registers ServerEventsFeature tries to send confirmation back to my client when it fails:

[PID:17304:015          20:17:11.394 ERROR EventSubscription                  ] Error publishing notification to: id: 1
data: cmd.onConnect {"userId":"-1","isAuthen
System.Web.HttpException (0x800704CD): 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)

When not running inside docker SSE works fine.

Could this be some kind of networking issue inside docker? Something preventing the streaming connection?

Server Events works fine in Docker/Linux which you can view in the Live Demo.

This Exception suggests the HTTP Connection SSE is trying to write to is getting closed. Maybe you have some incompatible configuration, e.g. have you disabled DynamicCompression?

I have disabled compression - I am thinking it has to be a windows networking docker related bug… but I have no way to prove this.

I seem to recall something previously where I was having trouble with the kind of streaming connection event-stream sets up through a NAT. And since windows docker sets up a NAT itself I am wondering if its the same issue

Sorry I was about to say case closed -
I dockerized the servicestack chat app for windows server 2016 docker, when I connect to the server directly from the host machine the app works fine.
But if I connect through the virtualized docker port I have the same issue - further confirming that this is most likely a windows issue. I’ll get in touch with with microsoft docker people and see what they think

This is the network activity I’m seeing (event-heartbeat keeps throwing said exception)

1 Like