forked from ElectronNET/Electron.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSocketIOOptions.cs
More file actions
65 lines (53 loc) · 1.84 KB
/
Copy pathSocketIOOptions.cs
File metadata and controls
65 lines (53 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using SocketIOClient.Transport;
using System;
using System.Collections.Generic;
namespace SocketIOClient
{
public sealed class SocketIOOptions
{
public SocketIOOptions()
{
RandomizationFactor = 0.5;
ReconnectionDelay = 1000;
ReconnectionDelayMax = 5000;
ReconnectionAttempts = int.MaxValue;
Path = "/socket.io";
ConnectionTimeout = TimeSpan.FromSeconds(20);
Reconnection = true;
Transport = TransportProtocol.Polling;
EIO = 4;
AutoUpgrade = true;
}
public string Path { get; set; }
public TimeSpan ConnectionTimeout { get; set; }
public IEnumerable<KeyValuePair<string, string>> Query { get; set; }
/// <summary>
/// Whether to allow reconnection if accidentally disconnected
/// </summary>
public bool Reconnection { get; set; }
public double ReconnectionDelay { get; set; }
public int ReconnectionDelayMax { get; set; }
public int ReconnectionAttempts { get; set; }
double _randomizationFactor;
public double RandomizationFactor
{
get => _randomizationFactor;
set
{
if (value >= 0 && value <= 1)
{
_randomizationFactor = value;
}
else
{
throw new ArgumentException($"{nameof(RandomizationFactor)} should be greater than or equal to 0.0, and less than 1.0.");
}
}
}
public Dictionary<string, string> ExtraHeaders { get; set; }
public TransportProtocol Transport { get; set; }
public int EIO { get; set; }
public bool AutoUpgrade { get; set; }
public object Auth { get; set; }
}
}