mirror of
https://github.com/trafficlunar/api.git
synced 2026-06-27 22:24:08 +00:00
feat: add timestamps to computer graph data
This commit is contained in:
parent
e97b271bd7
commit
43628a1a66
4 changed files with 52 additions and 20 deletions
|
|
@ -3,6 +3,7 @@ package handler
|
|||
import (
|
||||
"backend/internal/model"
|
||||
"backend/internal/service"
|
||||
"backend/internal/worker"
|
||||
"encoding/json"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
|
|
@ -35,7 +36,6 @@ func HandleComputerWebSocket(w http.ResponseWriter, r *http.Request) {
|
|||
slog.Info("WebSocket connection established!")
|
||||
service.ComputerData.Online = true
|
||||
|
||||
// Read messages
|
||||
for {
|
||||
_, message, err := conn.ReadMessage()
|
||||
if err != nil {
|
||||
|
|
@ -50,7 +50,7 @@ func HandleComputerWebSocket(w http.ResponseWriter, r *http.Request) {
|
|||
continue
|
||||
}
|
||||
|
||||
service.AddComputerData(clientMessage)
|
||||
worker.QueuedClientMessage = clientMessage
|
||||
slog.Info("Recieved message", slog.Any("message", clientMessage))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue