Added theme to message structure.
All checks were successful
Build Pogdark API / Build Pogdark API (pull_request) Successful in 15s
All checks were successful
Build Pogdark API / Build Pogdark API (pull_request) Successful in 15s
This commit is contained in:
parent
0eee8e006d
commit
6a26238712
7
main.go
7
main.go
@ -32,6 +32,7 @@ type Message struct {
|
||||
Name string `json:"Name"`
|
||||
Image string `json:"Image"`
|
||||
Status string `json:"Status"`
|
||||
Theme string `json:"Theme"`
|
||||
Timestamp string `json:"Timestamp"`
|
||||
}
|
||||
|
||||
@ -190,7 +191,7 @@ func sendAllRecordsToClient(client *Client) {
|
||||
if err != nil {
|
||||
log.Println("Unable to marshal JSON due to: ", err)
|
||||
}
|
||||
fmt.Printf("Broadcasting %s,%s,%s,%s\n", message.Id, message.Status, message.Name, message.Timestamp)
|
||||
fmt.Printf("Broadcasting %s,%s,%s,%s,%s\n", message.Id, message.Status, message.Name, message.Theme, message.Timestamp)
|
||||
go sendToClient(client, []byte(msgContent))
|
||||
}
|
||||
}
|
||||
@ -209,7 +210,7 @@ func (s *Server) listenForExpirationEvents() {
|
||||
expiredID := msg.Payload
|
||||
fmt.Println(expiredID)
|
||||
// Broadcast expiration event
|
||||
var message = Message{Id: expiredID, Name: "", Image: "", Status: "removed", Timestamp: ""}
|
||||
var message = Message{Id: expiredID, Name: "", Image: "", Status: "removed", Theme: "", Timestamp: ""}
|
||||
fmt.Printf("Broadcasting expiration: %s to %d clients\n", message, len(s.clients))
|
||||
broadcastSingleRecord(s, message)
|
||||
}
|
||||
@ -320,7 +321,7 @@ func setState(w http.ResponseWriter, r *http.Request, s *Server) {
|
||||
http.Error(w, "Failed to store data", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
fmt.Printf("Broadcasting message: %s,%s,%s,%s to %d clients\n", message.Id, message.Status, message.Name, message.Timestamp, len(s.clients))
|
||||
fmt.Printf("Broadcasting message: %s,%s,%s,%s,%s to %d clients\n", message.Id, message.Status, message.Name, message.Theme, message.Timestamp, len(s.clients))
|
||||
}
|
||||
|
||||
broadcastSingleRecord(s, message)
|
||||
|
Loading…
Reference in New Issue
Block a user