Better reconnect handling

This commit is contained in:
Christoph Stahl 2022-12-04 02:59:30 +01:00
parent e2ae632329
commit 1633db793b

View file

@ -101,6 +101,12 @@ function registerSocketEvents(socket) {
socket.on("connect", () => { joinRoom() }) socket.on("connect", () => { joinRoom() })
socket.io.on("reconnect", () => { joinRoom() })
socket.on("disconnect", () => {
connect();
});
socket.on("state", (val) => { socket.on("state", (val) => {
state.value.queue=val.queue state.value.queue=val.queue
state.value.recent=val.recent state.value.recent=val.recent
@ -129,6 +135,7 @@ function joinRoom() {
"install <a href='https://git.k-fortytwo.de/christofsteel/syng2.git' " + "install <a href='https://git.k-fortytwo.de/christofsteel/syng2.git' " +
"target='_blank'>Syng</a> and run it with <pre>syng-client " + "target='_blank'>Syng</a> and run it with <pre>syng-client " +
state.value.server + "</pre>" state.value.server + "</pre>"
state.socket.disconnect()
} }
}) })
} }