server
server copied to clipboard
Add KeepAliveMode option
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.
Todo:
- Add tests
Codecov Report
Attention: Patch coverage is 52.17391% with 55 lines in your changes missing coverage. Please review.
Project coverage is 89.06%. Comparing base (
a84c553) to head (2141f56). Report is 4 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #1154 +/- ##
==========================================
- Coverage 90.88% 89.06% -1.82%
==========================================
Files 50 51 +1
Lines 2425 2543 +118
Branches 432 450 +18
==========================================
+ Hits 2204 2265 +61
- Misses 175 224 +49
- Partials 46 54 +8
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.