private void SendKeepAliveFrameAsync()
{
bool acquiredLock = _sendFrameAsyncLock.Wait(0);
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.
SendFrameLockAcquiredNonCancelableAsync(MessageOpcode.Ping, true, new ArraySegment<byte>(Array.Empty<byte>()));
}
else
{
// If the lock is already held, something is already getting sent,
// so there's no need to send a keep-alive ping.
}
}