javascriptlong-pollingsignalr

How to determine server disconnection from SignalR client?


How can a SignalR JavaScript client detect when a connection with the server is lost?


Solution

  • The provided answers will no longer work. This is the new way to stop/disconnect connections.

    myHub.stop().then(() => {
      alert('Server has disconnected');
    });