16 using Newtonsoft.Json;
21 using System.Collections.Concurrent;
22 using System.Collections.Generic;
24 using System.Threading;
34 private const int ConnectionTimeout = 30000;
69 protected string ApiKey {
get;
set; }
84 protected void Initialize(
string wssUrl,
IWebSocket websocket, IRestClient restClient,
string apiKey,
string apiSecret)
91 JsonSettings =
new JsonSerializerSettings { FloatParseHandling = FloatParseHandling.Decimal };
100 Log.
Trace($
"BaseWebsocketsBrokerage(): WebSocket.Open. Subscribing");
132 Log.
Trace(
"BaseWebSocketsBrokerage.Connect(): Connecting...");
141 protected abstract bool Subscribe(IEnumerable<Symbol> symbols);
157 var resetEvent =
new ManualResetEvent(
false);
158 EventHandler triggerEvent = (o, args) => resetEvent.Set();
163 if (!resetEvent.WaitOne(ConnectionTimeout))
165 throw new TimeoutException(
"Websockets connection timeout.");