SignalR/SignalR — Issue #226: Recommended procedure when signalr server is offline
Author: jamesfoster
Created: 2012-03-07 11:51:56+00:00
State: open

Hi

I'm trying to create a more robust startup procedure. It's great that clients will retry if the connection drops. But what if the connection can't be made when the app starts?

I've tried

```c#
while(attempt++ < maxRetries)
{
try {
connection.Start().Wait();
return;
}
catch(Exception e) {
connection.Stop()
}
}
```

But this doesn't work. From looking at the code `Start` doesn't do anything if `IsActive` is true, the very next thing it does is set `IsActive` to true. `Stop` will only set `IsActive` to false if `_initialized` is true and I'm guessing `_initialized` never gets set to true if there is an error connecting?

Effectively, it gets into a state where it's not possible to use that connection object again.

Am I missing something?