Eventsource request never receive streams

Good morning Demis,

I looked into the forums and I couldn’t find any similar issue.

I have 2 servers, in one SSE is working like a charm, but when I deployed to a production environment, the eventsource request never established a connection and it got canceled after 18 minutes

Since I didn’t receive any error, these are some steps I did to try to track down the issue:

  • I added the ss-tok in the query string because I thought it could be an auth issue. (weird since the cookie was in the request) I think when I did this I was able to receive streams but after 10 minutes or so.
  • I made sure that all services have an IReturn interface and both servers have the same IIS configuration
  • I removed the Application Insights javascript and telemetry filter from the server since I thought this may cause any conflict
  • I removed the file system mapping I put in place

I’ve been struggling with this weird issue for 4 hours. Please, could you give me some insights?

Some info about my environment:

  • ServiceStack 5.8.0
  • .Net Framework 4.5
  • ISS 10.0
  • Windows Server 2016
  • Vuejs
  • @servicestack/client and ss-utils

Thank you


The general issue that can inhibit server events are if you have any kind of buffering, like compression enabled in your App or if you’re going through a proxy that buffers or terminates long-lived HTTP Connections.

For Web Clients, CORS is typically what prevent connections. If you can see any Response from the server that will tell you whether you’re able to connect at all, you can try using a HTTP Packet sniffer like Fiddler which can provide a better look at the raw HTTP traffic.

On the server you can handle events on ServerEventsFeature like OnInit to see if the connection to establish the SSE subscription is being received, if the subscription request is valid it will call OnCreated to create the subscription. If there’s an issue with the connection request it should fail immediately so you should see a HTTP Error Response code.

If there’s an error after the connection has been established in should fire OnError callback, and you can use OnUnsubscribe* to get called when the server has removed the subscription for any reason (i.e. failed heartbeat, error, client ends subscription, etc).

Thank you Demis, all those are great suggestions!

  • I looked into the compression. Both servers have enabled static and dynamic compression.
  • Requests aren’t going through a proxy.
  • I included some traces in the OnInit, OnCreated, and OnError events, a connection was established in both servers and a subscription was created. There wasn’t any error. These are the JSON I got for each event:
    OnInit Request

    OnCreated Subscription
    image

On Monday, I will try with the OnUnsubscribe event, the sniffer, and the CORS option.

Thank you @mythz

As you recommended, it worked when I disabled the dynamic compression.

Do you have any clue about why this caused issues only in one server?

DynamicCompression is a known issue which forces buffering which delays the SSE events from being sent immediately, my guess is that the other server had it disabled elsewhere or other handler/feature enabled which prevents buffering.

1 Like