3

I have a SignalR Chat application which is deployed on a server. The chatbox which users see should be renderd by the Chat Application in an iframe, on the targeted website.

I have problems with:

Task OnDisconnected(bool stopCalled)

If the Chat Application is up and running, and the connection is made with the server (for the admin side), and I close the tab, the OnDisconnected gets called instantly with stopCalled = true;

However, from the client page, which is a separate website in IIS, on port 81, instead of 80, if I connect and close the window, then OnDisconnected is called with a delay, and stopCalled is false;

Another weird thing is that if I render the client chat window from the Chat Application (i.e. entering the iframe's URL in a new tab, which renders the page on the same domain), the OnDisconnected is called instantly. So I suppose this is happening due to the client being either :

  • rendered in an iframe
  • rendered on a different domain
  • both

Has anyone encountered this before ? I'm not sure what other details to give, I can give more if needed.

Using ASP.NET MVC 5, signalR 2.2.0, running on IIS 10

Thanks in advance, Vlad

---- Update ----

I pulled everything out of the iframe and this is still happening.

Vlad
  • 536
  • 1
  • 5
  • 18
  • Are you sure you do not have any Javascript event handler intercepting the unload of your page in the admin case and explicitly calling `stop()` on your connection? Did you try going in the SignalR code and put a breakpoint inside `stop()` to see if you get called there? Just wondering, the `stopCalled = true` bit is suspicious. – Wasp Sep 21 '15 at 11:39
  • isn't stopCalled supposed to be true if the user closes the browser or the tab ? So the weird thing is it being false in the same scenario, on the client side – Vlad Sep 21 '15 at 16:32
  • `stopCalled` is true when `stop()` has been called explicitly. Check here: http://stackoverflow.com/a/24898839/720780 – Wasp Sep 22 '15 at 06:22

0 Answers0