using CryptoExchange.Net.Objects; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; namespace CryptoExchange.Net.Sockets { /// /// Parameters for a websocket /// public class WebSocketParameters { /// /// The uri to connect to /// public Uri Uri { get; set; } /// /// Headers to send in the connection handshake /// public IDictionary Headers { get; set; } = new Dictionary(); /// /// Cookies to send in the connection handshake /// public IDictionary Cookies { get; set; } = new Dictionary(); /// /// The time to wait between reconnect attempts /// public TimeSpan ReconnectInterval { get; set; } = TimeSpan.FromSeconds(5); /// /// Proxy for the connection /// public ApiProxy? Proxy { get; set; } /// /// Whether the socket should automatically reconnect when connection is lost /// public bool AutoReconnect { get; set; } /// /// The maximum time of no data received before considering the connection lost and closting/reconnecting the socket /// public TimeSpan? Timeout { get; set; } /// /// Interval at which to send ping frames /// public TimeSpan? KeepAliveInterval { get; set; } /// /// The max amount of messages to send per second /// public int? RatelimitPerSecond { get; set; } /// /// Origin header value to send in the connection handshake /// public string? Origin { get; set; } /// /// Delegate used for processing byte data received from socket connections before it is processed by handlers /// public Func? DataInterpreterBytes { get; set; } /// /// Delegate used for processing string data received from socket connections before it is processed by handlers /// public Func? DataInterpreterString { get; set; } /// /// Encoding for sending/receiving data /// public Encoding Encoding { get; set; } = Encoding.UTF8; /// /// ctor /// /// Uri /// Auto reconnect public WebSocketParameters(Uri uri, bool autoReconnect) { Uri = uri; AutoReconnect = autoReconnect; } } }