changed the stats payload
As it turns out there are other citizens of this world, not just the botclient. So I have properly labeled the payload with a type. This makes the web front-end less breaky.
This commit is contained in:
parent
7bb5ae59b3
commit
ff3f9a5137
@ -247,7 +247,14 @@ func addPlayer(ws *websocket.Conn) {
|
||||
p.Robots = append(p.Robots, &r)
|
||||
}
|
||||
|
||||
err = websocket.JSON.Send(ws, &convertedStats)
|
||||
statsPayload := struct {
|
||||
Stats map[string]Stats `json:"stats"`
|
||||
Type string `json:"type"`
|
||||
}{
|
||||
Stats: convertedStats,
|
||||
Type: "stats",
|
||||
}
|
||||
err = websocket.JSON.Send(ws, &statsPayload)
|
||||
if err != nil {
|
||||
log.Printf("error sending convertedStats to client: %s", err)
|
||||
websocket.JSON.Send(ws, NewFailure("protocol error: convertedStats"))
|
||||
|
Loading…
Reference in New Issue
Block a user