Send server stat updates over the websocket

This commit is contained in:
Dane Everitt
2019-09-05 22:08:10 -07:00
parent 923a9fbcab
commit 64f477f423
3 changed files with 14 additions and 0 deletions

View File

@@ -317,6 +317,9 @@ func (d *DockerEnvironment) EnableResourcePolling() error {
s.Resources.Network.RxBytes += nw.RxBytes
s.Resources.Network.TxBytes += nw.TxBytes
}
b, _ := json.Marshal(s.Resources)
s.Emit(StatsEvent, string(b))
}
}(d.Server)

View File

@@ -9,6 +9,7 @@ type EventListenerFunction *func(string)
const (
ConsoleOutputEvent = "console output"
StatusEvent = "status"
StatsEvent = "stats"
)
// Adds an event listener for the server instance.