1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-08-14 18:02:58 +00:00

Added optional delay after socket connection, added callback when reconnected socket to revitalize original request, fixed proxy setting socket

This commit is contained in:
JKorf
2022-11-13 19:47:33 +01:00
parent 3365837338
commit ad614830d1
5 changed files with 41 additions and 16 deletions
@@ -378,6 +378,9 @@ namespace CryptoExchange.Net
if (!connectResult)
return new CallResult<bool>(connectResult.Error!);
if (Options.DelayAfterConnect != TimeSpan.Zero)
await Task.Delay(Options.DelayAfterConnect).ConfigureAwait(false);
if (!authenticated || socket.Authenticated)
return new CallResult<bool>(true);
@@ -541,6 +544,16 @@ namespace CryptoExchange.Net
return Task.FromResult<Uri?>(connection.ConnectionUri);
}
/// <summary>
/// Update the original request to send when the connection is restored after disconnecting. Can be used to update an authentication token for example.
/// </summary>
/// <param name="request">The original request</param>
/// <returns></returns>
public virtual Task<CallResult<object>> RevitalizeRequestAsync(object request)
{
return Task.FromResult(new CallResult<object>(request));
}
/// <summary>
/// Gets a connection for a new subscription or query. Can be an existing if there are open position or a new one.
/// </summary>