feat: implement permanent broadcast message functionality

- add SendPermanentBroadCastMessage to continuously send updates
- refactor BroadcastMessage to use a shared Message struct
- update pomodoro logic to modify broadcast.Message directly
- adjust client command handling to use broadcast.Clients map
- enhance ServerMessage struct with "Ongoing" and "Paused" fields

🤖
This commit is contained in:
Sebastian Mark 2024-10-21 08:16:26 +02:00
parent eba4065c6f
commit 9615d4d449
8 changed files with 75 additions and 65 deletions

View file

@ -3,6 +3,7 @@ package server
import (
"flag"
"fmt"
"git.smsvc.net/pomodoro/GoTomato/internal/broadcast"
"git.smsvc.net/pomodoro/GoTomato/internal/websocket"
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
"log"
@ -23,6 +24,7 @@ func Start() {
listen := fmt.Sprintf("%s:%d", serverConfig.ListenAddress, serverConfig.ListenPort)
http.HandleFunc("/ws", websocket.HandleConnections)
go broadcast.SendPermanentBroadCastMessage()
log.Printf("Pomodoro WebSocket server started on %s\n", listen)
err := http.ListenAndServe(listen, nil)