diff --git a/protocol.go b/protocol.go index 9abaad3..2670bb1 100644 --- a/protocol.go +++ b/protocol.go @@ -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"))