2024-10-27 09:41:31 +00:00
|
|
|
package frontend
|
|
|
|
|
|
|
|
import (
|
2024-10-27 20:34:53 +00:00
|
|
|
"github.com/gorilla/websocket"
|
|
|
|
|
2024-10-27 09:41:31 +00:00
|
|
|
ChronoTomato "git.smsvc.net/pomodoro/ChronoTomato/pkg/models"
|
|
|
|
GoTomato "git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
|
|
|
)
|
|
|
|
|
|
|
|
var message GoTomato.ServerMessage
|
|
|
|
|
|
|
|
func Handler(conn *websocket.Conn, config ChronoTomato.Config, channel <-chan GoTomato.ServerMessage) {
|
|
|
|
keyhandler_quit := make(chan bool, 1)
|
|
|
|
go keyhandler(conn, config, &message, keyhandler_quit)
|
|
|
|
|
|
|
|
for {
|
|
|
|
select {
|
|
|
|
case message = <-channel:
|
|
|
|
desktopNotifications(message)
|
|
|
|
terminalOutput(message)
|
|
|
|
case <-keyhandler_quit:
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|