Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add KeepAliveMode and SupportedWebSocketSubProtocols options #80

Merged
merged 1 commit into from
Oct 27, 2024

Conversation

Shane32
Copy link
Owner

@Shane32 Shane32 commented Oct 27, 2024

Adds a 'secure' keep-alive mode where:

  • A ping is sent on a timer from the last received pong
  • Ping messages carry a unique payload (random guid)
  • Received pong messages verify the payload
  • If a pong is not received with the correctly id in a timely fashion, the client is forcibly disconnected

Reason:

  • With subscriptions that continuously send lots of data, there is no way to determine if socket backpressure due to slow client connections is causing resource exhaustion. This feature will validate that buffers are drained over the specified time period, as the client would not know what id to send with a pong if it did not process the incoming messages fast enough.

Consider:

  • Name of KeepAliveMode enum values
  • Adding separate timer property that represents the amount of time to wait for a corresponding pong after a sent ping. Currently this just matches the ping timer.

@Shane32 Shane32 added this to the 6.1.0 milestone Oct 27, 2024
@Shane32 Shane32 self-assigned this Oct 27, 2024
Copy link

Coverage Report

Totals Coverage
Statements: 94.8% ( 1933 / 2039 )
Methods: 81.42% ( 298 / 366 )

@Shane32 Shane32 merged commit d8d46a5 into master Oct 27, 2024
5 checks passed
@Shane32 Shane32 deleted the keepalivemode branch October 27, 2024 14:25
@coveralls
Copy link

Pull Request Test Coverage Report for Build 11541224015

Details

  • 60 of 103 (58.25%) changed or added relevant lines in 6 files are covered.
  • 4 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-1.9%) to 92.691%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/GraphQL.AspNetCore3/WebSockets/GraphQLWebSocketOptions.cs 1 2 50.0%
src/GraphQL.AspNetCore3/WebSockets/SubscriptionsTransportWs/SubscriptionServer.cs 7 8 87.5%
src/GraphQL.AspNetCore3/WebSockets/BaseSubscriptionServer.cs 22 27 81.48%
src/GraphQL.AspNetCore3/WebSockets/GraphQLWs/SubscriptionServer.cs 28 64 43.75%
Files with Coverage Reduction New Missed Lines %
src/GraphQL.AspNetCore3/GraphQLHttpMiddleware.cs 4 94.24%
Totals Coverage Status
Change from base Build 11541128763: -1.9%
Covered Lines: 1933
Relevant Lines: 2039

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants