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:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user