-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* v4.0: - timeouts - change miliseconds to TimeSpan - last chance - disabling - stream fake message - StartOrFail, ReconnectOrFail - fail fast approach, throws exception on connection error * ReconnectionHappened and DisconnectionHappened - extend response, add additional info about close status and caused exception * DisconnectionHappened stream - enable canceling reconnection
- Loading branch information
Showing
20 changed files
with
835 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bitmex/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Fakely/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=releaser/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=subprotocol/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=testnet/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
using System.Net.WebSockets; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace Websocket.Client | ||
{ | ||
/// <summary> | ||
/// Info about happened disconnection | ||
/// </summary> | ||
public class DisconnectionInfo | ||
{ | ||
/// <inheritdoc /> | ||
public DisconnectionInfo(DisconnectionType type, WebSocketCloseStatus? closeStatus, | ||
string closeStatusDescription, string subProtocol, Exception exception) | ||
{ | ||
Type = type; | ||
CloseStatus = closeStatus; | ||
CloseStatusDescription = closeStatusDescription; | ||
SubProtocol = subProtocol; | ||
Exception = exception; | ||
} | ||
|
||
/// <summary> | ||
/// Disconnection reason | ||
/// </summary> | ||
public DisconnectionType Type { get; } | ||
|
||
/// <summary> | ||
/// Indicates the reason why the remote endpoint initiated the close handshake | ||
/// </summary> | ||
public WebSocketCloseStatus? CloseStatus { get; } | ||
|
||
/// <summary> | ||
/// Allows the remote endpoint to describe the reason whe the connection was closed | ||
/// </summary> | ||
public string CloseStatusDescription { get; } | ||
|
||
/// <summary> | ||
/// The subprotocol that was negotiated during the opening handshake | ||
/// </summary> | ||
public string SubProtocol { get; } | ||
|
||
/// <summary> | ||
/// Exception that cause disconnection, can be null | ||
/// </summary> | ||
public Exception Exception { get; } | ||
|
||
|
||
/// <summary> | ||
/// Set to true if you want to cancel ongoing reconnection | ||
/// </summary> | ||
public bool CancelReconnection { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Simple factory method | ||
/// </summary> | ||
public static DisconnectionInfo Create(DisconnectionType type, WebSocket client, Exception exception) | ||
{ | ||
return new DisconnectionInfo(type, client?.CloseStatus, client?.CloseStatusDescription, | ||
client?.SubProtocol, exception); | ||
} | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
src/Websocket.Client/DisconnectionType.cs → ...socket.Client/Models/DisconnectionType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace Websocket.Client.Models | ||
{ | ||
/// <summary> | ||
/// Info about happened reconnection | ||
/// </summary> | ||
public class ReconnectionInfo | ||
{ | ||
/// <inheritdoc /> | ||
public ReconnectionInfo(ReconnectionType type) | ||
{ | ||
Type = type; | ||
} | ||
|
||
/// <summary> | ||
/// Reconnection reason | ||
/// </summary> | ||
public ReconnectionType Type { get; } | ||
|
||
/// <summary> | ||
/// Simple factory method | ||
/// </summary> | ||
public static ReconnectionInfo Create(ReconnectionType type) | ||
{ | ||
return new ReconnectionInfo(type); | ||
} | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
src/Websocket.Client/ReconnectionType.cs → ...bsocket.Client/Models/ReconnectionType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.