Skip to content

Commit

Permalink
Change ManagedWebSocket to send pong frame for keep-alive (dotnet#35644)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephentoub authored May 1, 2020
1 parent 9a29391 commit e83f6db
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,9 @@ private void SendKeepAliveFrameAsync()
if (acquiredLock)
{
// This exists purely to keep the connection alive; don't wait for the result, and ignore any failures.
// The call will handle releasing the lock.
ValueTask t = SendFrameLockAcquiredNonCancelableAsync(MessageOpcode.Ping, true, Memory<byte>.Empty);
// The call will handle releasing the lock. We send a pong rather than ping, since it's allowed by
// the RFC as a unidirectional heartbeat and we're not interested in waiting for a response.
ValueTask t = SendFrameLockAcquiredNonCancelableAsync(MessageOpcode.Pong, true, ReadOnlyMemory<byte>.Empty);
if (t.IsCompletedSuccessfully)
{
t.GetAwaiter().GetResult();
Expand Down

0 comments on commit e83f6db

Please sign in to comment.