1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-08-19 04:13:02 +00:00

Small basesocket changes, added total request prop to rest client

This commit is contained in:
JKorf
2019-01-09 11:40:13 +01:00
parent 2b1c77577c
commit b5a80a3095
5 changed files with 17 additions and 4 deletions
+4 -2
View File
@@ -35,6 +35,7 @@ namespace CryptoExchange.Net.Sockets
public bool ShouldReconnect { get; set; }
public bool Reconnecting { get; set; }
public string Origin { get; set; }
public string Url { get; }
public bool IsClosed => socket.State == WebSocketState.Closed;
@@ -173,6 +174,7 @@ namespace CryptoExchange.Net.Sockets
{
lock (socketLock)
{
log.Write(LogVerbosity.Debug, $"Socket {Id} resetting");
socket?.Dispose();
socket = null;
}
@@ -187,7 +189,7 @@ namespace CryptoExchange.Net.Sockets
{
if (socket == null)
{
socket = new WebSocket(Url, cookies: cookies.ToList(), customHeaderItems: headers.ToList())
socket = new WebSocket(Url, cookies: cookies.ToList(), customHeaderItems: headers.ToList(), origin: Origin ?? "")
{
EnableAutoSendPing = true,
AutoSendPingInterval = 10
@@ -243,7 +245,7 @@ namespace CryptoExchange.Net.Sockets
}
if (socket.State == WebSocketState.Connecting)
Close().Wait();
socket.Close();
return connected;
}).ConfigureAwait(false);
@@ -1,4 +1,5 @@
using CryptoExchange.Net.Interfaces;
using System.Collections.Generic;
using CryptoExchange.Net.Interfaces;
using CryptoExchange.Net.Logging;
namespace CryptoExchange.Net.Sockets
@@ -9,5 +10,10 @@ namespace CryptoExchange.Net.Sockets
{
return new BaseSocket(log, url);
}
public IWebsocket CreateWebsocket(Log log, string url, IDictionary<string, string> cookies, IDictionary<string, string> headers)
{
return new BaseSocket(log, url, cookies, headers);
}
}
}