feat: refactor connection handling to use models.Client
- introduce `Client` model
- modify all websocket operations to use the new `Client` model
- update function signatures to accept `models.Client` instead of `*websocket.Conn`
- ensure consistent usage of `client` across all related functions
🤖
This commit is contained in:
parent
f1071f33c6
commit
b943c9d6eb
6 changed files with 26 additions and 24 deletions
|
@ -2,7 +2,6 @@ package frontend
|
|||
|
||||
import (
|
||||
"github.com/eiannone/keyboard"
|
||||
ws "github.com/gorilla/websocket"
|
||||
|
||||
"git.smsvc.net/pomodoro/ChronoTomato/internal/websocket"
|
||||
|
||||
|
@ -10,7 +9,7 @@ import (
|
|||
GoTomato "git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
||||
)
|
||||
|
||||
func UpdateLoop(conn *ws.Conn, config ChronoTomato.Config, channel <-chan GoTomato.ServerMessage) {
|
||||
func UpdateLoop(client ChronoTomato.Client, config ChronoTomato.Config, channel <-chan GoTomato.ServerMessage) {
|
||||
var message GoTomato.ServerMessage
|
||||
|
||||
keysEvents, _ := keyboard.GetKeys(1)
|
||||
|
@ -22,7 +21,7 @@ func UpdateLoop(conn *ws.Conn, config ChronoTomato.Config, channel <-chan GoToma
|
|||
desktopNotifications(message)
|
||||
terminalOutput(message)
|
||||
case keypress := <-keysEvents:
|
||||
if !keyhandler(keypress, conn, config, message) {
|
||||
if !keyhandler(keypress, client, config, message) {
|
||||
return
|
||||
}
|
||||
case <-websocket.Done:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue