Archived
2
0

add members & host to stats.

This commit is contained in:
m1k1o
2021-03-19 22:06:40 +01:00
parent bbae073104
commit b96ba47224
4 changed files with 23 additions and 9 deletions
README.md
server/internal

@ -51,11 +51,9 @@ func New(conf *config.Server, webSocketHandler types.WebSocketHandler) *Server {
}
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(struct{
Connections uint32 `json:"connections"`
}{
Connections: webSocketHandler.TotalConns(),
}); err != nil {
stats := webSocketHandler.Stats()
if err := json.NewEncoder(w).Encode(stats); err != nil {
logger.Warn().Err(err).Msg("failed writing json error response")
}
})