Search code examples
c#azuresignalrazure-web-roles

What is buffering SignalR Server Sent Events on Azure Web Role?


I have a Xamarin app that connects to a SignalR server hosted on Azure.

Since it's Xamarin running over mono, websockets are not available.

When my server was hosted on Azure Mobile Services, the app used SSE.

I moved the server to a web role because mobile services were too limited.

Now my app fails to connect using SSE and falls back to long polling after the 5 seconds timeout interval.

I tried creating a new Web Role and only adding SignalR. Still get the same problem.

I have identified/tried the following:

  1. It looks like the SSE request is being buffered somewhere in Azure. If I use a proxy I can see the request but the first response byte is received only after SignalR times out and closes the connection.
  2. There is no proxy or similar on my network - I can still connect over SSE to my old mobile services server.
  3. I turned on tracing on the server and it looks like SignalR is doing its thing - it returns the response to the SSE connect request.
  4. I can also see the SSE request in IIS in the AuthorizeRequest stage which means the connection is opened.
  5. I disabled dynamic compression. Didn't help.

To summarize, looks like the SSE connection is made, remains open, but something prevents the data from SignalR from reaching the client.

I read here that this can be an issue with the Http Platform Handler. But as far as I understand, this is not relevant to web role since it's normal C# code running in IIS.


Solution

  • Try using HTTPS - it will prevent proxies from messing with the event stream.