Server send events are getting delayed in azure web app

680 Views Asked by At

I have created server send events to send the messages from node server. Everything works fine in localhost but when I deploy it to azure web app it takes nearly 15 to 20 seconds to send the data to the client. Do i need to configure anything in azure. Hope someone can help me out from this issue. Thanks in advance.

2

There are 2 best solutions below

0
On

In my case it was buffering issue. I did not get a response or got with huge delay.

I have added headers to disable cache and buffering for the response.

Cache-Control: no-cache;

X-Accel-Buffering: no;

It helped me.

1
On

It could be a buffering issue. Depending on your browser and which polyfill you are using, messages get cached until the cache is flushed.

Since it works locally, there may be a difference in the node version running locally and the version on the App Service (I am assuming that you are running the node app in App Service, and using the same browser to test locally and in Azure).

For more details see: https://github.com/EventSource/eventsource/issues/88