-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add KeepAliveMode and SupportedWebSocketSubProtocols options (#80)
- Loading branch information
Showing
13 changed files
with
416 additions
and
20 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
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
12 changes: 12 additions & 0 deletions
12
src/GraphQL.AspNetCore3/WebSockets/GraphQLWs/PingPayload.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace GraphQL.AspNetCore3.WebSockets.GraphQLWs; | ||
|
||
/// <summary> | ||
/// The payload of the ping message. | ||
/// </summary> | ||
public class PingPayload | ||
{ | ||
/// <summary> | ||
/// The unique identifier of the ping message. | ||
/// </summary> | ||
public string? id { get; set; } | ||
} |
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,36 @@ | ||
namespace GraphQL.AspNetCore3.WebSockets; | ||
|
||
/// <summary> | ||
/// Specifies the mode of keep-alive behavior. | ||
/// </summary> | ||
public enum KeepAliveMode | ||
{ | ||
/// <summary> | ||
/// Same as <see cref="Timeout"/>: Sends a unidirectional keep-alive message when no message has been received within the specified timeout period. | ||
/// </summary> | ||
Default = 0, | ||
|
||
/// <summary> | ||
/// Sends a unidirectional keep-alive message when no message has been received within the specified timeout period. | ||
/// </summary> | ||
Timeout = 1, | ||
|
||
/// <summary> | ||
/// Sends a unidirectional keep-alive message at a fixed interval, regardless of message activity. | ||
/// </summary> | ||
Interval = 2, | ||
|
||
/// <summary> | ||
/// Sends a Ping message with a payload after the specified timeout from the last received Pong, | ||
/// and waits for a corresponding Pong response. Requires that the client reflects the payload | ||
/// in the response. Forcibly disconnects the client if the client does not respond with a Pong | ||
/// message within the specified timeout. This means that a dead connection will be closed after | ||
/// a maximum of double the <see cref="GraphQLWebSocketOptions.KeepAliveTimeout"/> period. | ||
/// </summary> | ||
/// <remarks> | ||
/// This mode is particularly useful when backpressure causes subscription messages to be delayed | ||
/// due to a slow or unresponsive client connection. The server can detect that the client is not | ||
/// processing messages in a timely manner and disconnect the client to free up resources. | ||
/// </remarks> | ||
TimeoutWithPayload = 3, | ||
} |
Oops, something went wrong.