add sleep for 2 seconds before /join on reconnect, may be moving too fast and it gets lost

This commit is contained in:
Salastil
2025-10-23 11:16:47 -04:00
parent e4c7f1e7f5
commit 0d92a3aeb0

View File

@@ -226,9 +226,17 @@ func (c *Client) handleDisconnect() {
}
log.Println("🟢 Reconnected successfully")
// 🚦 Allow websocket handshake to stabilize
time.Sleep(2 * time.Second)
// 🔁 Re-join chat room and verify connection
c.joinRoom()
c.Send("/ping")
log.Printf("🔁 Rejoined Sneedchat room %d after reconnect", c.roomID)
}
func (c *Client) Disconnect() {
close(c.stopCh)
c.mu.Lock()