From 94e7b414210581c49e345ab178fb83a748bade4a Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Wed, 13 Nov 2024 17:12:54 +0100 Subject: [PATCH] fix: preserve client password during reconnection process --- internal/websocket/receive.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/websocket/receive.go b/internal/websocket/receive.go index 4aeb6ad..e4638a6 100644 --- a/internal/websocket/receive.go +++ b/internal/websocket/receive.go @@ -29,8 +29,14 @@ func (c *Client) ProcessServerMessages(channel chan<- GoTomato.ServerMessage) { // Try to reconnect on unexpected disconnect for { channel <- prevMessage // send previous ServerMessage to update view + time.Sleep(time.Second) + + // reconnect while preserving password + pw := c.Password *c = Connect(c.Server) + c.Password = pw + if c.Connected() { break }