1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-08-15 18:33:06 +00:00

Various socket client changes

This commit is contained in:
JKorf
2018-11-23 15:50:43 +01:00
parent 8b1f9af458
commit b1085bc764
6 changed files with 148 additions and 48 deletions
@@ -0,0 +1,42 @@
using System;
using System.Threading.Tasks;
namespace CryptoExchange.Net.Sockets
{
public class UpdateSubscription
{
private SocketSubscription subscription;
/// <summary>
/// Event when the connection is lost
/// </summary>
public event Action ConnectionLost
{
add => subscription.ConnectionLost += value;
remove => subscription.ConnectionLost -= value;
}
/// <summary>
/// Event when the connection is restored. Timespan parameter indicates the time the socket has been offline for before reconnecting
/// </summary>
public event Action<TimeSpan> ConnectionRestored
{
add => subscription.ConnectionRestored += value;
remove => subscription.ConnectionRestored -= value;
}
public UpdateSubscription(SocketSubscription sub)
{
subscription = sub;
}
/// <summary>
/// Close the subscription
/// </summary>
/// <returns></returns>
public async Task Close()
{
await subscription.Close();
}
}
}