Class WolfClientReconnector
Utility that will attempt to automatically reconnect the client on disconnection.
Implements
Namespace: TehGM.Wolfringo.Utilities
Assembly: Wolfringo.Utilities.dll
Syntax
public class WolfClientReconnector : IDisposable
Remarks
This utility will try yo reconnect on all disconnections. If you wish to stop this behaviour, dispose this object by calling Dispose(). To re-enable, simply create a new instance again.
In case a reconnection fails, FailedToReconnect will be raised, and the class will be disposed automatically. To re-enable, create a new instance.
Any IWolfClient should have only one instance of this utility active at once.
If using IHostedWolfClient from Wolfringo.Hosting package, do not use this utility. The default hosted client has auto-reconnecting behaviour built-in.
Constructors
| Improve this Doc View SourceWolfClientReconnector(IWolfClient)
Creates instance of reconnector using default config values.
Declaration
public WolfClientReconnector(IWolfClient client)
Parameters
Type | Name | Description |
---|---|---|
IWolfClient | client | Client to automatically reconnect. |
WolfClientReconnector(IWolfClient, ReconnectorConfig)
Creates instance of reconnector.
Declaration
public WolfClientReconnector(IWolfClient client, ReconnectorConfig config)
Parameters
Type | Name | Description |
---|---|---|
IWolfClient | client | Client to automatically reconnect. |
ReconnectorConfig | config | Reconnector configuration. |
Properties
| Improve this Doc View SourceConfig
Configuration for reconnecting.
Declaration
public ReconnectorConfig Config { get; }
Property Value
Type | Description |
---|---|
ReconnectorConfig |
Methods
| Improve this Doc View SourceDispose()
Disposes the instance by removing event handlers.
Declaration
public void Dispose()
Remarks
After this method is called, the utility will no longer automatically reconnect. To continue this behaviour, create a new instance of this utility.
Events
| Improve this Doc View SourceFailedToReconnect
Raised when client fails to reconnect.
Declaration
public event EventHandler<UnhandledExceptionEventArgs> FailedToReconnect
Event Type
Type | Description |
---|---|
EventHandler<UnhandledExceptionEventArgs> |
Remarks
The object will be disposed after this event executes.