diff --git a/CryptoExchange.Net/CryptoExchange.Net.csproj b/CryptoExchange.Net/CryptoExchange.Net.csproj index a7730e7..2b702dc 100644 --- a/CryptoExchange.Net/CryptoExchange.Net.csproj +++ b/CryptoExchange.Net/CryptoExchange.Net.csproj @@ -7,7 +7,7 @@ CryptoExchange.Net JKorf - 0.0.10 + 0.0.11 false https://github.com/JKorf/CryptoExchange.Net https://github.com/JKorf/CryptoExchange.Net/blob/master/LICENSE diff --git a/CryptoExchange.Net/Implementation/BaseSocket.cs b/CryptoExchange.Net/Implementation/BaseSocket.cs index 7727bb1..e6c975f 100644 --- a/CryptoExchange.Net/Implementation/BaseSocket.cs +++ b/CryptoExchange.Net/Implementation/BaseSocket.cs @@ -30,6 +30,8 @@ namespace CryptoExchange.Net.Implementation public BaseSocket(string url, IDictionary cookies, IDictionary headers) { socket = new WebSocket(url, cookies: cookies.ToList(), customHeaderItems: headers.ToList()); + socket.EnableAutoSendPing = true; + socket.AutoSendPingInterval = 10; socket.Opened += (o, s) => Handle(openhandlers); socket.Closed += (o, s) => Handle(closehandlers); socket.Error += (o, s) => Handle(errorhandlers, s.Exception); @@ -79,7 +81,7 @@ namespace CryptoExchange.Net.Implementation socket.Close(); evnt.WaitOne(); socket.Closed -= handler; - }); + }).ConfigureAwait(false); } public void Send(string data) @@ -100,7 +102,7 @@ namespace CryptoExchange.Net.Implementation socket.Opened -= handler; socket.Closed -= handler; return socket.State == WebSocketState.Open; - }); + }).ConfigureAwait(false); } public void SetEnabledSslProtocols(SslProtocols protocols)