mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-08 00:16:27 +00:00
Updated test websocket
This commit is contained in:
parent
e86623a0b7
commit
28c42e3e5e
@ -7,7 +7,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>CryptoExchange.Net</PackageId>
|
<PackageId>CryptoExchange.Net</PackageId>
|
||||||
<Authors>JKorf</Authors>
|
<Authors>JKorf</Authors>
|
||||||
<PackageVersion>0.0.29</PackageVersion>
|
<PackageVersion>0.0.30</PackageVersion>
|
||||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||||
<PackageProjectUrl>https://github.com/JKorf/CryptoExchange.Net</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/JKorf/CryptoExchange.Net</PackageProjectUrl>
|
||||||
<PackageLicenseUrl>https://github.com/JKorf/CryptoExchange.Net/blob/master/LICENSE</PackageLicenseUrl>
|
<PackageLicenseUrl>https://github.com/JKorf/CryptoExchange.Net/blob/master/LICENSE</PackageLicenseUrl>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Security.Authentication;
|
using System.Security.Authentication;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -8,6 +9,8 @@ namespace CryptoExchange.Net.Implementation
|
|||||||
{
|
{
|
||||||
public class TestWebsocket: IWebsocket
|
public class TestWebsocket: IWebsocket
|
||||||
{
|
{
|
||||||
|
public List<string> MessagesSend = new List<string>();
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -30,8 +33,16 @@ namespace CryptoExchange.Net.Implementation
|
|||||||
public bool PingConnection { get; set; }
|
public bool PingConnection { get; set; }
|
||||||
public TimeSpan PingInterval { get; set; }
|
public TimeSpan PingInterval { get; set; }
|
||||||
|
|
||||||
|
public bool HasConnection = true;
|
||||||
|
|
||||||
public Task<bool> Connect()
|
public Task<bool> Connect()
|
||||||
{
|
{
|
||||||
|
if (!HasConnection)
|
||||||
|
{
|
||||||
|
OnError(new Exception("No connection"));
|
||||||
|
return Task.FromResult(false);
|
||||||
|
}
|
||||||
|
|
||||||
IsClosed = false;
|
IsClosed = false;
|
||||||
IsOpen = true;
|
IsOpen = true;
|
||||||
OnOpen?.Invoke();
|
OnOpen?.Invoke();
|
||||||
@ -41,6 +52,14 @@ namespace CryptoExchange.Net.Implementation
|
|||||||
|
|
||||||
public void Send(string data)
|
public void Send(string data)
|
||||||
{
|
{
|
||||||
|
if (!HasConnection)
|
||||||
|
{
|
||||||
|
OnError(new Exception("No connection"));
|
||||||
|
Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MessagesSend.Add(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EnqueueMessage(string data)
|
public void EnqueueMessage(string data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user