17 lines
No EOL
613 B
C#
17 lines
No EOL
613 B
C#
namespace Foxcord.Gateway;
|
|
|
|
public partial class DiscordGatewayClient
|
|
{
|
|
private void HandleHeartbeatAck()
|
|
{
|
|
_lastHeartbeatAck = DateTimeOffset.UtcNow;
|
|
_logger.Verbose("Received heartbeat ACK after {Latency}", _lastHeartbeatAck - _lastHeartbeatSend);
|
|
}
|
|
|
|
private async Task HandleHeartbeatRequest(CancellationToken ct = default)
|
|
{
|
|
_logger.Information("Early heartbeat requested, sending heartbeat");
|
|
await WritePacket(new GatewayPacket { Opcode = GatewayOpcode.Heartbeat, Payload = _lastSequence }, ct);
|
|
_lastHeartbeatSend = DateTimeOffset.UtcNow;
|
|
}
|
|
} |