Unregister PING timer when destroying client

This commit is contained in:
Simon Ser 2021-05-28 09:58:06 +02:00
parent 24fe62f1de
commit 7b762b3e8a
2 changed files with 20 additions and 5 deletions

View file

@ -548,11 +548,8 @@ export default class App extends Component {
this.switchToChannel = params.autojoin[0];
}
if (this.config.server && this.config.server.ping > 0) {
// TODO: unregister setInterval on disconnect
setInterval(() => {
client.send({ command: "PING", params: ["gamja"] });
}, this.config.server.ping * 1000);
if (this.config.server && typeof this.config.server.ping === "number") {
client.setPingInterval(this.config.server.ping);
}
}