refactor: move broadcast.Message to shared.Message

- create a new shared state file to manage message state
- replace broadcast.Message with shared.Message in pomodoro logic
- update websocket client handling to use shared.Clients
- remove unnecessary broadcast imports from various files
- ensure consistent message handling across the application

🤖
This commit is contained in:
Sebastian Mark 2024-10-21 09:20:58 +02:00
parent 234f3c17dc
commit aab6896c7d
6 changed files with 44 additions and 40 deletions

View file

@ -2,7 +2,6 @@ package websocket
import (
"encoding/json"
"git.smsvc.net/pomodoro/GoTomato/internal/broadcast"
"git.smsvc.net/pomodoro/GoTomato/internal/pomodoro"
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
"github.com/gorilla/websocket"
@ -25,7 +24,7 @@ func handleClientCommands(ws *websocket.Conn) {
_, message, err := ws.ReadMessage()
if err != nil {
log.Printf("Client disconnected: %v", err)
delete(broadcast.Clients, ws)
delete(Clients, ws)
break
}