Send server stat updates over the websocket
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ type EventListenerFunction *func(string)
|
||||
const (
|
||||
ConsoleOutputEvent = "console output"
|
||||
StatusEvent = "status"
|
||||
StatsEvent = "stats"
|
||||
)
|
||||
|
||||
// Adds an event listener for the server instance.
|
||||
|
||||
Reference in New Issue
Block a user