Skip to content

Commit b34a381

Browse files
committed
Refactor WebSocket event handling in Home component to use more specific event names for disconnect and error scenarios
1 parent d9f8d87 commit b34a381

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

components/home.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,8 +1804,7 @@ export default function Home({ }) {
18041804
ws.onclose = () => {
18051805
setWs(null)
18061806
console.log("ws closed")
1807-
sendEvent("multiplayer_disconnect")
1808-
1807+
sendEvent("multiplayer_wsclose")
18091808
setMultiplayerState((prev) => ({
18101809
...initialMultiplayerState,
18111810
maxRetries: prev.maxRetries,
@@ -1829,7 +1828,7 @@ export default function Home({ }) {
18291828
ws.onerror = () => {
18301829
setWs(null)
18311830
console.log("ws error")
1832-
sendEvent("multiplayer_disconnect")
1831+
sendEvent("multiplayer_wserror")
18331832

18341833
setMultiplayerState((prev) => ({
18351834
...initialMultiplayerState,

0 commit comments

Comments
 (0)