mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-13 09:23:04 +00:00
Squashed commit of the following:
commit0571ed17a0Author: JKorf <jankorf91@gmail.com> Date: Sun Jul 10 19:56:27 2022 +0200 Fixed tests commit99c331b389Author: JKorf <jankorf91@gmail.com> Date: Sun Jul 10 16:41:14 2022 +0200 Updated version commit70f8bd203aAuthor: JKorf <jankorf91@gmail.com> Date: Sun Jul 10 16:36:00 2022 +0200 Finished up websocket refactoring commit89b517c936Author: JKorf <jankorf91@gmail.com> Date: Fri Jul 8 20:24:58 2022 +0200 wip commit91e33cc42cAuthor: JKorf <jankorf91@gmail.com> Date: Thu Jul 7 22:17:55 2022 +0200 wip
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
using CryptoExchange.Net.Objects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.Sockets
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters for a websocket
|
||||
/// </summary>
|
||||
public class WebSocketParameters
|
||||
{
|
||||
/// <summary>
|
||||
/// The uri to connect to
|
||||
/// </summary>
|
||||
public Uri Uri { get; set; }
|
||||
/// <summary>
|
||||
/// Headers to send in the connection handshake
|
||||
/// </summary>
|
||||
public IDictionary<string, string> Headers { get; set; } = new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
/// Cookies to send in the connection handshake
|
||||
/// </summary>
|
||||
public IDictionary<string, string> Cookies { get; set; } = new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
/// The time to wait between reconnect attempts
|
||||
/// </summary>
|
||||
public TimeSpan ReconnectInterval { get; set; } = TimeSpan.FromSeconds(5);
|
||||
/// <summary>
|
||||
/// Proxy for the connection
|
||||
/// </summary>
|
||||
public ApiProxy? Proxy { get; set; }
|
||||
/// <summary>
|
||||
/// Whether the socket should automatically reconnect when connection is lost
|
||||
/// </summary>
|
||||
public bool AutoReconnect { get; set; }
|
||||
/// <summary>
|
||||
/// The maximum time of no data received before considering the connection lost and closting/reconnecting the socket
|
||||
/// </summary>
|
||||
public TimeSpan? Timeout { get; set; }
|
||||
/// <summary>
|
||||
/// Interval at which to send ping frames
|
||||
/// </summary>
|
||||
public TimeSpan? KeepAliveInterval { get; set; }
|
||||
/// <summary>
|
||||
/// The max amount of messages to send per second
|
||||
/// </summary>
|
||||
public int? RatelimitPerSecond { get; set; }
|
||||
/// <summary>
|
||||
/// Origin header value to send in the connection handshake
|
||||
/// </summary>
|
||||
public string? Origin { get; set; }
|
||||
/// <summary>
|
||||
/// Delegate used for processing byte data received from socket connections before it is processed by handlers
|
||||
/// </summary>
|
||||
public Func<byte[], string>? DataInterpreterBytes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Delegate used for processing string data received from socket connections before it is processed by handlers
|
||||
/// </summary>
|
||||
public Func<string, string>? DataInterpreterString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Encoding for sending/receiving data
|
||||
/// </summary>
|
||||
public Encoding Encoding { get; set; } = Encoding.UTF8;
|
||||
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
/// <param name="uri">Uri</param>
|
||||
/// <param name="autoReconnect">Auto reconnect</param>
|
||||
public WebSocketParameters(Uri uri, bool autoReconnect)
|
||||
{
|
||||
Uri = uri;
|
||||
AutoReconnect = autoReconnect;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user