Skip to content

Commit

Permalink
fix: fix some typos (discordjs#7393)
Browse files Browse the repository at this point in the history
  • Loading branch information
DTrombett committed Feb 2, 2022
1 parent 351db67 commit 36d84a9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/networking/VoiceWebSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class VoiceWebSocket extends TypedEmitter<VoiceWebSocketEvents> {
* The time (milliseconds since UNIX epoch) that the last heartbeat was sent. This is set to 0 if a heartbeat
* hasn't been sent yet.
*/
private lastHeatbeatSend: number;
private lastHeartbeatSend: number;

/**
* The number of consecutively missed heartbeats.
Expand Down Expand Up @@ -75,7 +75,7 @@ export class VoiceWebSocket extends TypedEmitter<VoiceWebSocketEvents> {
this.ws.onclose = (e) => this.emit('close', e);

this.lastHeartbeatAck = 0;
this.lastHeatbeatSend = 0;
this.lastHeartbeatSend = 0;

this.debug = debug ? (message: string) => this.emit('debug', message) : null;
}
Expand Down Expand Up @@ -119,7 +119,7 @@ export class VoiceWebSocket extends TypedEmitter<VoiceWebSocketEvents> {
if (packet.op === VoiceOpcodes.HeartbeatAck) {
this.lastHeartbeatAck = Date.now();
this.missedHeartbeats = 0;
this.ping = this.lastHeartbeatAck - this.lastHeatbeatSend;
this.ping = this.lastHeartbeatAck - this.lastHeartbeatSend;
}

/**
Expand Down Expand Up @@ -151,9 +151,9 @@ export class VoiceWebSocket extends TypedEmitter<VoiceWebSocketEvents> {
* Sends a heartbeat over the WebSocket.
*/
private sendHeartbeat() {
this.lastHeatbeatSend = Date.now();
this.lastHeartbeatSend = Date.now();
this.missedHeartbeats++;
const nonce = this.lastHeatbeatSend;
const nonce = this.lastHeartbeatSend;
return this.sendPacket({
op: VoiceOpcodes.Heartbeat,
d: nonce,
Expand All @@ -169,7 +169,7 @@ export class VoiceWebSocket extends TypedEmitter<VoiceWebSocketEvents> {
if (typeof this.heartbeatInterval !== 'undefined') clearInterval(this.heartbeatInterval);
if (ms > 0) {
this.heartbeatInterval = setInterval(() => {
if (this.lastHeatbeatSend !== 0 && this.missedHeartbeats >= 3) {
if (this.lastHeartbeatSend !== 0 && this.missedHeartbeats >= 3) {
// Missed too many heartbeats - disconnect
this.ws.close();
this.setHeartbeatInterval(-1);
Expand Down

0 comments on commit 36d84a9

Please sign in to comment.